array operation a[] + b[] not implemented??

Lars T. Kyllingstad public at kyllingen.NOSPAMnet
Mon Jan 18 05:20:53 PST 2010


Trass3r wrote:
>> Quoting Andrei in his "Short list with things to finish for D2" post 
>> (2009-11-19):
>>
>>> * Loop fusion that generalizes array-wise operations. This idea of 
>>> Walter is, I think, very good because it generalizes and democratizes 
>>> "magic". The idea is that, if you do
>>>  a = b + c;
>>>  and b + c does not make sense but b and c are ranges for which 
>>> a.front = b.front + c.front does make sense, to automatically add the 
>>> iteration paraphernalia.
>>
>> If I read this correctly, what you're asking for will most likely happen.
>>
> 
> The question is, how much this is generalized with ranges. It needs to 
> detect the special case of arrays and use vector operations then.


Yeah, and most likely it will. But you can't expect every range to 
define the no-parameter opSlice() function, which means that the syntax 
for "range operations" should be just

   a = b + c;

It would then be pretty silly if we still had to use the

   a[] = b[] + c[];

syntax for the special case of arrays, so I assume that will change as well.

-Lars



More information about the Digitalmars-d mailing list