Es-discuss - several decimal discussions

Brendan Eich brendan at mozilla.org
Sun Aug 24 08:13:06 PDT 2008


On Aug 24, 2008, at 6:18 AM, Sam Ruby wrote:

> A modest
> request: if the code could be reviewed and feedback provided to me
> with sufficient time for me to address the comments and the code to be
> integrated into a nightly build, by default disabled, in time for the
> Redmond meeting, I would appreciate it.

Set the review flag to my bugzilla id -- othewise I won't see it in  
my request queue, and I'll probably forget to go review it on my own.  
Thanks.


> Let's posit for the moment that adding two nickles and calling
> toString() on the result produces "1.10"

Where'd the buck come from? ;-) Ok, I'm with you so far...


> Furthermore assume that 1.10m > 1.09m and that 1.10m < 1.11m.
>
> Given the above, as well as your knowledge of ES history, what would
> you expect the results of evaluating the following two expressions to
> be:
>
>   1.10m == 1.1m

true.


>   1.10m === 1.1m

true, but there's a weak case for false if you really insist that the  
significance is part of the value. If we make the result be false,  
then people who advocate always using === instead of == to avoid  
implicit conversions would be giving bad advice to Decimal users. I'm  
sticking with true for the reason given below.


> Depending on your answers, there may be a followup question.

Guy Steele, during ES1 standardization, pointed out that some Lisps  
have five equality-like operators. This helped us swallow === and !==  
(and keep the == operator, which is not an equivalence relation).

Must we go to this well again, and with Object.eq (not an operator),  
all just to distinguish the significance carried along for toString  
purposes? Would it not be enough to let those who care force a string  
comparison?

/be



More information about the Es-discuss mailing list