[phobos] Fixing Map

David Simcha dsimcha at gmail.com
Fri Sep 17 20:00:11 PDT 2010


  I'm thinking about improving/fixing std.algorithm.Map.  Two things I 
want to bounce off other Phobos devs:

1.  Should we just dump the cache?  I can't think of any other 
reasonable way to fix http://d.puremagic.com/issues/show_bug.cgi?id=4798 
.  In real world use cases the mapping function is cheap, and if not 
people will probably just call array() to do it eagerly.

2.  Should Map return by ref if possible?  This would enable idioms like 
this:

struct S {
     uint a, b, c;
}

ref uint getA(ref S s) { return s.a; }

auto sArray = new S[42];
sort(map!getA(sArray));




More information about the phobos mailing list