opPow, opDollar

Don nospam at nospam.com
Sat Nov 7 12:14:35 PST 2009


Walter Bright wrote:
> Andrei Alexandrescu wrote:
>> In order for everyone to air an informed opinion, a related question 
>> is: will loop fusion be allowed with function calls?
>>
>> Loop fusion currently only works with operators, and adding ^^ would 
>> allow:
>>
>> a[] = b[] ^^ 3;
>>
>> But with pow you can't do that:
>>
>> a[] = pow(b[], 3);
>>
>>
>> Andrei
>>
>> P.S. FWIW, I'm ambivalent on the issue; if functions were allowed for 
>> automatic loop fusion that would tilt my opinion in disfavor of ^^, 
>> and if not, it would tilt my opinion in favor of ^^.
> 
> 
> I don't think this is a valid argument for making pow() an operator, 
> because what about sin()? cos()? It's all the same issue, and they all 
> can't be operators.

It's another case where pow(x, 2) is not the same as x ^^ 2.
The argument for excluding exponentiation is largely, "pow does the same 
thing, without introducing an operator".





More information about the Digitalmars-d mailing list