std.data.json formal review

deadalnix via Digitalmars-d digitalmars-d at puremagic.com
Tue Aug 4 10:14:14 PDT 2015


On Tuesday, 4 August 2015 at 13:10:11 UTC, Sönke Ludwig wrote:
> This is how it used to be in the vibe.data.json module. I 
> consider that to be a mistake now for multiple reasons, at 
> least on this abstraction level. My proposal would be to have a 
> clean, "strongly typed" JSONValue and a generic jsvar like 
> struct on top of that, which is defined independently, and 
> could for example work on a BSONValue, too. The usage would 
> simply be "var value = parseJSONValue(...);".

That is not going to cut it. I've been working with these for 
ages. This is the very kind of scenarios where dynamically typed 
languages are way more convenient.

I've used both quite extensively and this is clear cut: you don't 
want what you call the strongly typed version of things. I've 
done it in many languages, including in java for instance.

jsvar interface remove the problematic parts of JS (use ~ instead 
of + for concat strings and do not implement the opDispatch part 
of the API).



More information about the Digitalmars-d mailing list