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

# Michael Davey (16 years ago)

Brendan Eich wrote:

I tried like hell in 1996-7 to get == and != to be what became === and !==, in JS1.2, at the same time ES1 was being standardized. At that point Microsoft had less market share than Netscape and therefore did not want to risk "breaking the web", so we standardized == and != as the crap-tastic non-equivalence relations they are, and added === and !==.

(Adding better forms and hoping to deprecate their precursors is a constant theme on the Web; nothing against Microsoft's position here, from this remove in time.)

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 !==.

# Brendan Eich (16 years ago)

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.