protocol for using InputRanges

Walter Bright newshound2 at digitalmars.com
Tue Mar 25 12:12:26 PDT 2014


On 3/23/2014 12:53 AM, Jonathan M Davis wrote:
> But again, front and empty should normally function as if they were variables.
> They should be property functions and should be pure (or at least act like
> they're pure).

This is simply not practical. The canonical example is a tty. You cannot tell if 
a character is available unless you try to read it. That is NOT pure.


> I'm sure that a _lot_ of code will break if that isn't followed.

It seems there have been a lot of undocumented assumptions about the behavior of 
ranges.



More information about the Digitalmars-d mailing list