array operation a[] + b[] not implemented??
Lars T. Kyllingstad
public at kyllingen.NOSPAMnet
Mon Jan 18 01:13:40 PST 2010
dsimcha wrote:
> As a side note, why isn't this allowed? It seems like a perfectly reasonable
> thing to have:
>
> float[] c = a[] + b;
>
> create a new array. The semantics of what this would do are unambiguous, it
> doesn't interact poorly (or at all) with the rest of the language in any way I can
> think of, the fact that it's not allowed is very surprising to newbies, and it's
> highly convenient. Why force people to write boilerplate code if there's no
> tradeoff and you're not gaining anything in return?
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.
-Lars
More information about the Digitalmars-d
mailing list