Two (or three) remarks:
(1) The following expressions are perfectly reasonable, where a, b, c, d are
variables holding numbers, and y is a variable (not a literal) holding a
boolean:
a < b == y
a < b == c < d
and even (although it demands some imagination):
a < b <= y
where x <= y is a hackish way to express the so-called material implication (x
→ y) as defined in:
http://en.wikipedia.org/wiki/Boolean_algebra#Derived_operations
Even if we ignore the last expression, it would be surprising (for, e.g.,
people used to Python), if we change the meaning of `a < b <= y` but not the
one of `a < b == c < d`, so we are probably bound to change the meaning of very
reasonable expressions anyway.
(2) If we change the meaning of `a < b < c`, then someone will use
var a = 1, b = 2, c = 3;
a < b < c; // true
in newer browsers, then check
var a = 1, b = 2, c = 3;
a < b < c; // true
in older browsers, and will fail to notice that their code is broken. In order
to mitigate that hazard (supposing we want to make the breaking change anyway),
we may want to invalidate expressions like `a < b < c` in ES6 (throwing a
Syntax Error) and redefine their meaning in ES7.
> "use chained comparisons";, anyone? ;-)
(3) Instead of a "use chained comparisons" directive, I dream of an implicit
"use perfect language" directive, where (1) typeof null === "null", (2) wrapper
objects around primitives do not exist, (3) chained comparisons are
implemented, (4) Date objects are not Y2K-broken by design, (5) Date objects
are compared by value, (6) concatenation and addition are not conflated into
one operator, (7) I am able to make coffee from within my preferred browser. :-)
—Claude
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss