opPow, opDollar
Lars T. Kyllingstad
public at kyllingen.NOSPAMnet
Sat Nov 7 02:38:35 PST 2009
Walter Bright wrote:
> Don wrote:
>> A little while ago I said I'd create a patch for ^^ as an
>> exponentiation. A couple of people had requested that I make a post to
>> the ng so they'd know when it happens. Here it is.
>>
>> This is opPow(), x ^^ y
>>
>> http://d.puremagic.com/issues/show_bug.cgi?id=3481
AWESOME! Thanks a lot, Don! I've been hoping for this since I started
using D.
Walter Bright wrote:
> I don't understand the rationale for an exponentiation operator. It
> isn't optimization, because pow() could become an intrinsic that the
> compiler knows about. pow() is well known, ^^ isn't. (Fortran uses **)
I don't understand the rationale for a concatenation operator. It isn't
optimization, because strcat() could become an intrinsic that the
compiler knows about. strcat() is well known, ~ isn't. (Java uses +)
I'm not trying to be rude, I'm just trying to illustrate that the first
point doesn't make a good case against an exponentiation operator. I can
only speak for myself, but I use exponentiation a lot. I mostly write
numerical code, and as I understand it, I'm not the only one in the
community doing so.
Being able to overload the exponentiation operator also makes a lot of
sense. Matrices and BigInts are the first things that come to mind.
-Lars
More information about the Digitalmars-d
mailing list