std.data.json formal review

Laeeth Isharc via Digitalmars-d digitalmars-d at puremagic.com
Wed Jul 29 10:04:32 PDT 2015


> Here's a thought: what about always storing JSON numbers as 
> strings (albeit tagged with the "number" type, to differentiate 
> them from actual strings in the input), and the user specifies 
> what type to convert it to?  The default type can be something 
> handy, like int, but the user has the option to ask for size_t, 
> or double, or even BigInt if they want (IIRC, the BigInt ctor 
> can initialize an instance from a digit string, so if we adopt 
> the convention that non-built-in number-like types can be 
> initialized from digit strings, then std.json can simply take a 
> template parameter for the output type, and hand it the digit 
> string. This way, we can get rid of the std.bigint dependency, 
> except where the user actually wants to use BigInt.)

Some JSON files can be quite large...

For example, I have a compressed 175 Gig of Reddit comments (one 
file per month) I would like to work with using D, and time + 
memory demands = money.

Wouldn't it be a pain not to store numbers directly when parsing 
in those cases (if I understood you correctly)?


More information about the Digitalmars-d mailing list