On Mon, Aug 24, 2015 at 3:45 PM, Waldemar Horwat <walde...@google.com> wrote: > 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
Agreed that the precedence should not bind sometimes tighter and sometimes looser is problematic. I think following the way other languages solve the same problem is more important for minimizing user surprise than any particular expression looking especially good. Looking kinda similar to other languages in surface syntax has been a major advantage of JS all along. Dan _______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss