Revisiting Decimal

Brendan Eich brendan at mozilla.com
Fri Jan 9 15:18:18 PST 2009


On Jan 9, 2009, at 3:08 PM, Kris Zyp wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
>
>> The counter-argument is strong:
>>
>> typeof x == typeof y => (x == y <=> x === y)
>>
>> but 1.1 != 1.1m for fundamental reasons.
> I understand the counter-argument, but with such an overwhelming
> number of typeof uses having far easier migration with "number",

Migration how? You'll have to change something to "use decimal" or s/ 
1.1/1.1m/. Only once you do that can you be sure about all operands  
being decimal.

I'm assuming it would be "bad" in the Dojo code you've looked at if  
1.1 came in from some standard library that returns doubles, and was  
tested against 1.1m via == or === with false result, where previous to  
decimal being added, the result would be true.


> I can't possibly see how the desire to preserve this property is more
> important than better usability for the majority use cases.

You really need to show some of these use cases from Dojo. I have a  
hard time believing you've ruled out mixed-mode accidents.

/be


More information about the Es-discuss mailing list