getNext

Mehrdad wfunction at hotmail.com
Mon Jul 9 12:03:49 PDT 2012


On Monday, 9 July 2012 at 18:51:40 UTC, Andrei Alexandrescu wrote:
>> If that's the case, I'd hate to tell you this, but _unless_ 
>> you're planning on removing the notion of input/output ranges 
>> (and perhaps adding single-pass/multi-pass), you're doing it 
>> wrong. :-)
>
> Given the smart-aleck nature of the comment I'd say 
> s/hate/love/.

lol, nice comment. +1

>> That capability is simply /not needed/ when your /only/ 
>> contract is that something is an input range.
>
> As I mentioned, "input range" is a misnomer. Think "one-pass 
> range". The range can be written or not, and a multi-pass range 
> (including random-access range) is also a one-pass range.

Sure, we all agree that a multi-pass range is also a one-pass 
range. I don't have a problem with that. But if you only use the 
one-pass range aspect, that doesn't mean it has to use the same 
syntax as the multi-pass range aspect.

The issue is, while you are /telling/ me that "input range" is a 
misnomer, that doesn't match what Phobos's is telling me. In 
Phobos, you've placed a very clear difference between "input 
ranges" and "output ranges", and /both/ of them are single-pass.
It looks like it was deliberately designed that way...  I don't 
think you made a mistake when separating input and output ranges 
like that (unless you do?).
So unless you're planning on trashing all that and redesigning 
the entire thing from scratch (are you?) I don't understand how 
you can have two orthogonal bases for working with ranges like 
this. (Pardon the math lingo, but that's really what they are -- 
input/output vs 
random-access/multi-pass-sequential-access/single-pass-sequential-access 
are two different bases for looking at the issue. You can't 
really mix them up in the same module...)


More information about the Digitalmars-d mailing list