On Mon, Jul 22, 2013 at 2:08 PM, Bjoern Hoehrmann <[email protected]> wrote:
> If that code is interpreted reliably and the behavior is desired, there > is no reason to assume that e.g. code obfuscators would not produce it. > Perhaps, but I think it's highly unlikely. It doesn't offer much obfuscation, considering that any third operand would certainly be truthy if the operator was greater than and falsy if the operator was less than. On Mon, Jul 22, 2013 at 2:24 PM, Claude Pache <[email protected]> wrote: > 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. > Well, as Tab pointed out, comparison operators have the same precedence in Python, whereas in JavaScript the equality operators have a lower precedence. So a < b == c < d is the same as (a < b) == (c < d). Only operators with the same precedence could be chained, where's the confusion in that? Python users still have to learn the same stuff when writing JavaScript. > (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. Yeah, I can see this being a problem. Invalidating in preparation to redefine doesn't sound like a great solution, though, because you'd still have the same problem when the next specification rolls around. Opt-in sounds like a better solution, if pragmas are to be entered into the specification then it could even become part of use strict;
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

