Should ^^ (opPow) be left- or right-associative?

Don nospam at nospam.com
Sat Dec 5 13:06:46 PST 2009


bearophile wrote:
> KennyTM~:
>> But the mathematical convention is a^b^c == a^(b^c).
>> Languages which the power operator is right-associative (3^3^3==7e12):
>>   - Python, Haskell, Ruby, Perl, Mathematica, Bash.
> 
> Doing things as in mathematical convention, Mathematica and Python sounds better.
> This was just the release V.0.1 of the built-in pow, it needs several improvements :-)
> 
> Bye,
> bearophile

Fortran too.
Here's a link from the TCL language, with a nice explanation of the 
rationale for choosing right associativity.

http://www.tcl.tk/cgi-bin/tct/tip/274.html



More information about the Digitalmars-d mailing list