Le 22 juil. 2013 à 17:55, Andy Earnshaw <[email protected]> a écrit :
> 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.
In the three languages you have cited (Python, Perl6 and CoffeeScript), all
comparison operators (both equality and inequality ones) can be chained
together. Introducing only half-baked chaining in ES will be quite confusing.
If we dare introduce chaining, which is already a disruptive change, we ought
to go until the end and to adjust the precedence of relational and equality
operators as well. (Actually, we would introduce an n-ary comparison operator.)
—Claude
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss