strict mode operators (was: Re: Operators ||= and &&=)

Brendan Eich brendan at mozilla.com
Thu May 7 07:49:50 PDT 2009


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.

/be


More information about the es-discuss mailing list