[phobos] Slices of ranges

Lars Tandle Kyllingstad lars at kyllingen.net
Wed Feb 2 04:54:02 PST 2011


A while ago I fixed issue 5052, but doing so I unwittingly broke David's
earlier fix for issue 4464.  I believe I have now fixed both issues (not
committed to main Phobos repo yet):

https://github.com/kyllingstad/phobos/commit/3948e3f61403bd7618913c36959158018970011d

While fixing this, I noted that Take!R simply aliases to R when R is a
type that supports slicing.  This assumes that the slice has the same
type as the slicee(?), which doesn't have to be the case -- at least as
far as the compiler or hasSlicing!() are concerned.

It is easy to fix in Take, but I've now discovered that the same
assumption is made in a lot of places: Retro, Stride, Chain... the list
goes on.  Just do a search for hasSlicing, or look for things like

    _input = _input[i .. j];

Fixing it everywhere is likely to be a lot of work.  Do you think it is
worth it, or is this a tiny corner case?

-Lars



More information about the phobos mailing list