Semantics of ^^

Don nospam at nospam.com
Tue Dec 8 19:50:44 PST 2009


Bill Baxter wrote:
> On Tue, Dec 8, 2009 at 2:32 AM, Don <nospam at nospam.com> wrote:
>> Based on everyone's comments, this is what I have come up with:
>>
>> --------------------
>> x ^^ y is right associative, and has a precedence intermediate between
>> multiplication and unary operators.
> 
> Is that consistent with math?   I think in math they usually write
> (-1)^n with parens.
> See for example the sin power series here:
> http://en.wikipedia.org/wiki/Power_series
> 
> What's the rationale for going against math here?

Hmm. Several other languages give it that precedence. But you're right, 
it should be even higher than unary. Between unary and postfix ?



More information about the Digitalmars-d mailing list