Can we fix reverse operator overloading (opSub_r et. al.)?

Lutger lutger.blijdestijn at gmail.com
Sat Jul 11 03:14:56 PDT 2009


"Jérôme M. Berger" wrote:
(...)
>> 
>> BLADE has already shown that it is possible to do stuff like this in a
>> library, but I think it goes without saying that if it was built into
>> the language the syntax could be made considerably nicer. Compare:
>> 
>>   auto m = MatrixOp!("a*A*B + b*C")(aVal, bVal, aMtrx, bMtrx, cMtrx);
>> 
>>   auto m = a*A*B + b*C;
>> 
>> If D could do this, I think it would become the next FORTRAN. :)
>> 
>> -Lars
> 
> Actually, this has already been done in C++:
> http://flens.sourceforge.net/ It should be possible to port it to D...
> 
> Jerome

Someone correct me if I'm wrong, but I think what Blade does is a bit more 
advanced than FLENS. Blade performs optimizations on the AST level and 
generates (near) optimal assembly at compile time. I couldn't find info on 
what FLENS does exactly beyond inlining through template expressions, but 
from the looks of it it doesn't do any of the AST level optimizations Blade 
does. Anyone care to provide more info? Can Blade also generate better asm 
than is possible with libraries such as FLENS?






More information about the Digitalmars-d mailing list