getNext

Mehrdad wfunction at hotmail.com
Mon Jul 9 08:34:34 PDT 2012


On Monday, 9 July 2012 at 15:16:52 UTC, Andrei Alexandrescu wrote:
> On 7/9/12 10:52 AM, Mehrdad wrote:
>> On Monday, 9 July 2012 at 14:48:05 UTC, Andrei Alexandrescu 
>> wrote:
>>> I think it's about the notion of "input range" that is 
>>> confusing, a
>>> better name would be "single-pass range". One should be 
>>> perfectly
>>> capable of assigning to elements of an input range. A 
>>> built-in slice
>>> is an input range.
>>>
>>> Andrei
>>
>> Aren't output ranges single-pass too?
>
> They don't have much of a notion of "pass" because the only 
> primitive of output ranges is "put".
>
> Andrei

Sorry? I don't know what you mean, but "single-pass" makes 
perfect sense to me for output ranges. Think: CD burning.



Anyway, what I'm saying is that if your code _only_ depends on 
the _input_ capabilities of a range, then it /cannot/ and _does 
not_ need the 'ref' capability.

You only need 'ref' for two reasons, so far as I can see:

- Writing
- Optimization

The latter point is moot here, and the former is _clearly_ not 
something an "input range" should have, because it's a notion of 
output...


More information about the Digitalmars-d mailing list