On Sunday, 26 April 2015 at 10:17:59 UTC, Manu wrote:
Array operations are super cool, and I'm using ranges (which kinda look and feel like arrays) more and more these days, but I can't help but feel like their incompatibility with the standard array operations
is a massive loss.

Let's say I want to assign one range to another: b[] = a[];
It's not clear to me why this should fall down if I want to apply a
lazy operation for instance: b[] = a.map!(e=>e*2)[];
... or something to that effect.

I find that my lazy ranges often end up on the stack, but I can't
assign/initialise directly: float[] a = b.transform[];
Instead I need to: float[] a;  b.transform.copy(a[]);

The fact that they don't mix with array expressions or operators means as soon as a lazy range finds it wants to enter existing array code,
it needs to be converted to a series of map()'s.

There must be years of thoughts and work on this sort of thing?
It seems arrays and ranges are unnecessarily distanced from
eachother... what are the reasons for this?

Vlad Levenfeld has been doing some interesting work on just this sort of thing. I will see if he is around.

Reply via email to