Exponential operator

Tim Matthews tim.matthews7 at gmail.com
Tue Aug 25 03:33:35 PDT 2009


Lars T. Kyllingstad Wrote:

> In the 'proposed syntax change' thread, Don mentioned that an 
> exponentiation operator is sorely missing from D. I couldn't agree more.
> 
> Daniel Keep has proposed the syntax
> 
>    a*^b
> 
> while my suggestion was
> 
>    a^^b
> 

I prefer the *^ syntax because:
1. ^^ looks like we a re including a new logical xor syntax
2. *^ has the asterix from the multiplication syntax while using the caret from the mathematical exponentiation syntax. Exponent is a kind of multiplication, with a default identity of 1.

Also if this feature does get included then the code:

a *^ b *^ c

should be evaluated as

a *^ (b *^ c)

not

(a *^ b) *^ c



More information about the Digitalmars-d mailing list