Exponentiation operator precedence

Jason Orendorff jason.orendorff at gmail.com
Wed Aug 26 18:14:15 UTC 2015

On Wed, Aug 26, 2015 at 11:09 AM, Mark S. Miller <erights at google.com> wrote:
> I don't get it. The conflict between
> * the history of ** in other languages,
> * the general pattern that unary binds tighter than binary
> seems unresolvable. By the first bullet, -2 ** 2 would be -4. By the second,
> it would be 4. Either answer will surprise too many programmers.

I just think the danger is not so great. Who's really going to be
surprised that `-x**2` is negative? This follows not only other
mainstream programming languages but a mathematical notation that has
been in common use for hundreds of years and is taught to every high
school algebra student.


More information about the es-discuss mailing list