On Thu, Oct 6, 2011 at 12:01 AM, Quildreen Motta <[email protected]>wrote:

> On 05/10/11 23:06, Brendan Eich wrote:
>
>> 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:
>>>>
>>>> - 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.
>>
>
Yes, == and === work fine. The problem is not in how they work, but in the
learning curve for new users of the language. I think most expect == to work
as ===. That, combined with object wrappers for values (new Number(5), new
Boolean(false), etc), seems to be an endless source of confusion for
beginners.

Of course pretty much every operator does type coercion, so tampering with
== and === could be as much detrimental as constructive.


Juan
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to