Exponentiation operator precedence

Joe Gibbs Politz joe at cs.brown.edu
Thu Aug 27 19:45:31 UTC 2015

On Thu, Aug 27, 2015 at 2:58 PM, Alexander Jones <alex at weej.com> wrote:
> Ethan is making my point far better than I did, and I agree completely about
> the issue of unary operators visually appearing more tightly bound than
> binary operators.
> At this point it seems fair to at least acknowledge the prospect of
> significant whitespace.
> ```
> -x**2 === -(x ** 2)
> -x ** 2 === (-x) ** 2
> ```

One kind of cost that I haven't seen mentioned (and is relevant
re:whitespace) is the impact on minifiers and other tools that use JS
as output, which have to deal with operator precedence/whitespace
rules in quite complicated ways.  There's a nice recent piece about
precedence bugs in a minifier:


Making the creation and maintenance of systems like minifiers harder
is a real cost worth bearing in mind when updating already-subtle
existing rules.

More information about the es-discuss mailing list