On 08/24/2015 10:08, Jason Orendorff wrote:
In math, -x² is -(x²), not (-x)². But as proposed for JS, -x**2 is (-x)**2.
PHP, Python, Haskell, and D side with the traditional algebraic
notation, against JS. Here's PHP:
$ php -r 'print(-2 ** 2);'
-4
Python:
>>> -2 ** 2
-4
Haskell:
Prelude> -2 ^ 2
-4
The D grammar: http://dlang.org/grammar.html#UnaryExpression
Let's switch.
Let's not. As I said at the last meeting, making ** bind tighter than unary
operators would break x**-2. And making it sometimes tighter and sometimes
looser would be too confusing and lead to other opportunities for precedence
inversion.
Waldemar
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss