Tricky semantics of ranges & potentially numerous Phobos bugs

H. S. Teoh hsteoh at quickfur.ath.cx
Thu Oct 18 08:34:41 PDT 2012


On Thu, Oct 18, 2012 at 09:09:03AM +0200, Don Clugston wrote:
> On 17/10/12 23:41, H. S. Teoh wrote:
[...]
> >I think I'm not so sure about Andrei's lumping input ranges with
> >persistent return values from .front together with forward ranges.
> >Some algorithms, like findAdjacent, do not need a forward range, but
> >they do need a persistent .front. I do not like the idea of
> >artificially limiting the scope of findAdjacent just because you
> >can't assume input ranges' .front returns a persistent value. Like
> >somebody else mentioned, whether .front is transient or not is
> >orthogonal to whether the range is an input range or a forward range.
> >There can be ranges whose .front is persistent, but they can't be
> >forward ranges for practical reasons.
> 
> Is it actually orthogonal? Is it possible for a forward range to be
> transient?
[...]

What about a range over all permutations of an array, that modifies the
array in-place? It can be a forward range by having .save copy the
current state of the array, but .front is transient nonetheless.


T

-- 
Life is too short to run proprietary software. -- Bdale Garbee


More information about the Digitalmars-d mailing list