std.jgrandson
Dicebot via Digitalmars-d
digitalmars-d at puremagic.com
Sun Aug 3 08:43:07 PDT 2014
On Sunday, 3 August 2014 at 15:14:43 UTC, Andrei Alexandrescu
wrote:
>> 3. Use of "opDispatch" for an open set of members has been
>> criticized
>> for vibe.data.json before and I agree with that criticism. The
>> only
>> advantage is saving a few keystrokes (json.key instead of
>> json["key"]),
>> but I came to the conclusion that the right approach to work
>> with JSON
>> values in D is to always directly deserialize when/if possible
>> anyway,
>> which mostly makes this is a moot point.
>
> Interesting. Well if experience with opDispatch is negative
> then it should probably not be used here, or only offered on an
> opt-in basis.
I support this opinion. opDispatch looks cool with JSON objects
when you implement it but it results in many subtle quirks when
you consider something like range traits for example - most
annoying to encounter and debug. It is not worth the gain.
More information about the Digitalmars-d
mailing list