JSON numbers (was: Revisiting Decimal)

Brendan Eich brendan at mozilla.com
Thu Jan 15 19:57:30 PST 2009

On Jan 15, 2009, at 7:46 PM, David-Sarah Hopwood wrote:

> David-Sarah Hopwood wrote:
>> Brendan Eich wrote:
>>> We are not condemned to repeat history if we pay attention to what  
>>> went
>>> before. JSON implementations in future ES specs cannot by default  
>>> switch
>>> either encoding or decoding to use decimal instead of number.
>> Of course not, but they can easily provide a non-default switch to do
>> so.
> I meant the preceding sentence to apply to decoding. It is simply
> incorrect to say that JSON implementations in future ES specs could
> not *encode* ES decimals as JSON numbers.

It is simply bad manners to assert without proof.

What happens when future codecs send decimals that round badly or lose  
precision fatally to older codecs? You can say those are just bugs to  
be fixed by someone, but that avoids responsibility for avoiding the  
situation in the first place.

You are assuming that "approximating" decimals encoded in JSON but  
decoded into doubles is acceptable. I don't think that's a safe  


More information about the Es-discuss mailing list