RFC: std.json sucessor

Sönke Ludwig via Digitalmars-d digitalmars-d at puremagic.com
Mon Aug 25 06:51:03 PDT 2014


Am 25.08.2014 14:12, schrieb "Ola Fosheim Grøstad" 
<ola.fosheim.grostad+dlang at gmail.com>":
> On Monday, 25 August 2014 at 11:30:15 UTC, Sönke Ludwig wrote:
>> I've added support (compile time option [1]) for long and BigInt in
>> the lexer (and parser), see [2]. JSONValue currently still only stores
>> double for numbers.
>
> It can be very useful to have a base 10 exponent representation in
> certain situations where you need to have the exact same results in two
> systems (like a third party ERP server versus a client side
> application). Base 2 exponents are tricky (incorrect) when you read ascii.
>
> E.g. I have resorted to using Decimal in Python just to avoid the weird
> round off issues when calculating prices where the price is given in
> fractions of the order unit.
>
> Perhaps a marginal problem, but could be important for some serious
> application areas where you need to integrate D with existing systems
> (for which you don't have the source code).

In fact, I've already prepared the code for that, but commented it out 
for now, because I wanted to have an efficient algorithm for converting 
double to Decimal and because we should probably first add a Decimal 
type to Phobos instead of adding it to the JSON module.


More information about the Digitalmars-d mailing list