Recommendations on avoiding range pipeline type hell

Chris Piker chris at hoopjump.com
Sun May 16 09:55:31 UTC 2021


On Sunday, 16 May 2021 at 09:17:47 UTC, Jordan Wilson wrote:

> Another example:
> ```d
> auto r = [iota(1,10).map!(a => a.to!int),iota(1,10).map!(a => 
> a.to!int)];
> # compile error
> ```
Hi Jordan

Nice succinct example.  Thanks for looking at the code :)

So, honest question.  Does it strike you as odd that the exact 
same range definition is considered to be two different types?

Maybe that's eminently reasonable to those with deep knowledge, 
but it seems crazy to a new D programmer.  It breaks a general 
assumption about programming when copying and pasting a 
definition yields two things that aren't the same type. (except 
in rare cases like SQL where null != null.)

On a side note, I appreciate that `.array` solves the problem, 
but I'm writing pipelines that are supposed to work on 
arbitrarily long data sets (> 1.4 TB is not uncommon).



More information about the Digitalmars-d-learn mailing list