std.data.json formal review

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Fri Aug 14 01:03:33 PDT 2015


On 8/14/2015 12:14 AM, Sönke Ludwig wrote:
> Am 14.08.2015 um 07:11 schrieb Walter Bright:
>> 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.

Two other solutions:

1. 'real' has enough precision to hold 64 bit integers.

2. You can use a union of 'long' and a template type T. Use the 'long' if it 
fits, and T if it doesn't.



More information about the Digitalmars-d mailing list