Transience of .front in input vs. forward ranges

H. S. Teoh hsteoh at quickfur.ath.cx
Mon Nov 5 20:51:14 PST 2012


On Tue, Nov 06, 2012 at 03:36:54AM +0200, Andrei Alexandrescu wrote:
> On 11/6/12 3:06 AM, H. S. Teoh wrote:
> >I've already given a number of non-trivial examples of transient
> >forward ranges, and apparently deadalnix has also encountered the
> >same issue.
> 
> I'd like to build more of this argument. I pointed out that your range
> is actually defining .dup, not .save. I think an argument can be made
> that forward ranges with transient .front do not qualify as forward
> ranges, seeing as a forward range is modeled after a list that
> actually has data sitting in memory.
[...]

I suppose you could argue that way. But that still doesn't solve the
problem of std.array.array with input ranges. Making std.array.array
require forward ranges seems to defeat its purpose, to me. So even if
you get rid of transience in forward ranges, you still need to make that
distinction with input ranges. Which still requires large-scale code
changes to existing Phobos algorithms. And which still requires some
sort of complication to the existing range code.


T

-- 
Music critic: "That's an imitation fugue!"


More information about the Digitalmars-d mailing list