August 25, 2009 Re: Exponential operator | ||||
---|---|---|---|---|
| ||||
Posted in reply to Lars T. Kyllingstad | 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
|
Copyright © 1999-2021 by the D Language Foundation