On Sunday, 3 August 2014 at 19:54:12 UTC, Sönke Ludwig wrote:
Am 03.08.2014 20:57, schrieb w0rp:
My issue with is is that if you ask for a key in an object
which doesn't
exist, you get an 'undefined' value back, just like
JavaScript. I'd
rather that be propagated as a RangeError, which is more
consistent with
associative arrays in the language and probably more correct.
Yes, this is what I meant with the JavaScript part of API. In
addition to opIndex(), there should of course also be a
.get(key, default_value) style accessor and the "in" operator.
There is a parallel discussion about the concept of associative
ranges:
http://forum.dlang.org/thread/jheurakujksdlrjao...@forum.dlang.org
Maybe you could also have a look there, because JSON seems to be
a good candidate for an associative range.