You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm not going to implement this (although should be easy to create a UFCS external method if you really want it).
Reasons:
I don't like the idea of constructing and then unpacking a Node, because of performance but mainly because it will complicate eventual pure/@safe annotations I'm adding as related issues are fixed in Phobos.
I want the API to be more explicit than implicit (make it obvious what you're doing by using containsKey() vs maybe reading the value or maybe not reading it.
There's a simple (although more verbose) pattern to achieve the same thing. First declare all variables you're about to read initialized with their defaults, then read all of them in a try/catch block, and silently ignore a throw.
And I like the idea that a missing value throws by default (with default values, I would not get that throw; I'd have to explicitly check for the error instead (yeah, this is an opposite side of the implicit/explicit thing))
Yes, I realize most of these are subjective and can be argued for both sides.
Add a way to get a default value if the node does not exist.
Current:
New
The text was updated successfully, but these errors were encountered: