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

Don nospam at nospam.com
Sat Dec 5 21:22:17 PST 2009


Tim Matthews wrote:
> Don wrote:
>> 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
> 
> Don I thought you were the one who created the patch 
> http://d.puremagic.com/issues/show_bug.cgi?id=3481
> 
> What was your reason for the choice of left associativity? 

It was a quick patch to determine if Walter could be swayed to include 
it, if he didn't need to implement it. I didn't get any positive 
feedback about it until it was put into svn.



More information about the Digitalmars-d mailing list