On Oct 5, 2011, at 7:01 PM, Quildreen Motta wrote: > On 05/10/11 22:05, Brendan Eich wrote: >> On Oct 4, 2011, at 7:19 AM, Juan Ignacio Dopazo wrote: >> >>> Yes, tools should be better, but they need to start becoming better by >>> themselves as previous discussions here have noted. >>> >>> However, there are problems in the language that need to be addressed by >>> both syntax and APIs. We need: >>> >>> - A sane way of dealing with equality, identity and basically a lot of >>> what's in http://wtfjs.com/ >> >> Some of that is due to implicit conversions, not any equality-ish operator. > I really never understood people's complaints about equality comparisons in > JavaScript. There are only two operators, with clear and well defined > semantics/use-cases: > > `==' (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. > `===' (Strict equality) is used for comparing the value of two objects, > taking data-structure into account. This operator is fine, unless you want to test (NaN is NaN) or (-0 isnt 0). There, you need is/isnt. > Could someone enlighten me on what is not intuitive or "sane" about that? I > mean, my starting point for comparing equality operator sanity is Common > Lisp's with its 10+ equality predicates — some being > implementation-dependant, so YMMV. Yes, during ES1 days Guy Steele said we were not worse than Common Lisp. Still doesn't excuse ==/!= in the case of operands of different types. /be _______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

