=== again (sorry)

Mike Cowlishaw MFC at uk.ibm.com
Thu Nov 13 09:42:29 PST 2008


> >> The indexOf and lastIndexOf methods are new in ES3.1, and are the 
only
> >> methods in the entire spec that depend on ===.
> >
> > Strictly speaking that's true, but only because the switch statement 
is not
> > a method.  switch statements depend on ===.
> 
> There was a recently reported bug for SpiderMonkey where the
> implementation treated -0 as not equal to 0 for some optimized switch
> cases. Given that the bug was present in the code at least since 1998
> this gives indications that even for a switch a change to use
> Object.identical, not ===, could be compatible with the web.

Igor, that may (or may not) be helpful.  'equal to' has many 
interpretations.  Do you mean "numerically equal to"?  In which case the 
mathematical interpretation of the strings "-0", "0.00", "-0e16234" and 
"0000000000" are all the same.  But in the real world, "drive for 10.3 
miles and then turn left", "drive for 10.0 miles and then turn left", 
"drive for 10 miles and then turn left" lead to quite different driver 
behaviors.

mfc





Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number 
741598. 
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU








More information about the Es-discuss mailing list