Code layout for range-intensive D code

bearophile bearophileHUGS at lycos.com
Mon Jun 11 05:13:16 PDT 2012


ixid:

> Having to append .array() all the time is rather annoying. I 
> can't help but feel that there's a better solution than this. 
> Are lazy Result methods really the default way of doing things? 
> I'd rather have eager versions.

In most cases having a lazy range is the right default. On the 
other hand in D many times you can't use lazy ranges, you need 
arrays, so the ".array()" is quite common after a map or filter. 
So I propose to add to Phobos two small functions named 
amap/afilter that produce arrays:
http://d.puremagic.com/issues/show_bug.cgi?id=5756

If you think those are redundant, then first of all take a look 
here:
http://d.puremagic.com/issues/show_bug.cgi?id=8155

Bye,
bearophile


More information about the Digitalmars-d mailing list