std.data.json formal review

Sönke Ludwig via Digitalmars-d digitalmars-d at puremagic.com
Fri Aug 14 00:14:33 PDT 2015


Am 14.08.2015 um 07:11 schrieb Walter Bright:
> On 8/12/2015 12:44 AM, Sönke Ludwig wrote:
>> That's where Decimal would come in. There is some code for that
>> commented out,
>> but I really didn't want to add it without a standard Phobos
>> implementation. But
>> I wouldn't say that this is really an argument against BigInt, maybe
>> more one
>> for implementing a Decimal type.
>
> Make the type for storing a Number be a template parameter.
>

Then we'd lose the ability to distinguish between integers and floating 
point in the same lexer instantiation, which is vital for certain input 
files to avoid losing precision for 64-bit integers. The only solution 
would be to use Decimal, but that doesn't exist yet and would be slow.

But the use of BigInt is already controlled by a template parameter, 
only the std.bigint import is currently there unconditionally.

Hm, another idea would be to store a void* (to a BigInt) instead of a 
BigInt and only import std.bigint locally in the accessor functions.


More information about the Digitalmars-d mailing list