strict mode operators (was: Re: Operators ||= and &&=)
On May 7, 2009, at 2:09 AM, Michael Davey wrote:
That is an interesting point. I understand the desire to keep ES5 strict mode as minimal as possible but I do wonder whether it could go further in 'correcting' the mis-features of ES by banning == and != for instance. Or perhaps they could be removed from ES Harmony except in some kind of 'ES5 compatibility' mode?
No one would use strict mode for existing code.
The == and != ship sailed 12 years go. Lots of code depends on == not
being ===, and some code uses === well too. This is not going to
change easily or predictably. In particular we can't "make" it change
by too much difference between strict and non-strict modes. Realize
that IE6 is still out there, and IE7-8, Firefox 3 and up, and other
browsers lacking any ES5 strict mode support, never mind a future
change to Harmony.
Back on topic, I do quite like the concept of &&& and ||| complementing === and !==.
Why? Didn't my point about && and || not being broken comparably,
requiring "more of the same" characters to "fix", carry any weight? I
also cited precedent from other languages favoring ??. Some want the
"Elvis" operator, the "?:" token, from Groovy instead; either is
better because shorter than the triple-| proposal and different-in-kind.
Different-enough operators should be spelled differently.
Brendan Eich wrote:
That is an interesting point. I understand the desire to keep ES5 strict mode as minimal as possible but I do wonder whether it could go further in 'correcting' the mis-features of ES by banning == and != for instance. Or perhaps they could be removed from ES Harmony except in some kind of 'ES5 compatibility' mode? Back on topic, I do quite like the concept of &&& and ||| complementing === and !==.