On Oct 5, 2011, at 8:01 PM, Quildreen Motta wrote: > On 05/10/11 23:06, Brendan Eich wrote: >>> `==' (Abstract equality) is used for comparing the value of two objects, >>> without taking data-structure into account. >> This operator is insane due to implicit conversions it does when operand >> types are not the same. In such cases it is not an equivalence relation. > I would argue this is not entirely true. It would depend on what you consider > "equivalence".
"Equivalence relation" is a well-defined technical phrase, and I was employing it intentionally. Please read http://en.wikipedia.org/wiki/Equivalence_relation and note the three required properties: an e.r. must be reflexive, symmetric, and transitive. "" == 0 && 0 == "0" but "" != "0" in JS. If == were transitive, then "" would have to == "0". (NaN != NaN violates "reflexive" but it's a special case for numerical analysts, I'm told -- other languages do likewise.) >> This operator is fine, unless you want to test (NaN is NaN) or (-0 isnt 0). >> There, you need is/isnt. > Is `egal' already in ES.next? Already answered -- wiki.ecmascript.org/doku.php?id=harmony:egal. That link remains in harmony:proposals. /be _______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

