On Thursday, 27 March 2014 at 21:54:00 UTC, Andrei Alexandrescu wrote:
On 3/27/14, 1:58 PM, Walter Bright wrote:
On 3/27/2014 12:50 PM, Andrei Alexandrescu wrote:
Yah, agreed. -- Andrei

Completely unworkable. To determine if a range is empty or not, it may have to actually read from its input. TTYs are an example. Although empty may then cache the result, and not read the second time it is called, an observer of TTY could see that an item was read from the TTY.

That's a good point too.

Andrei

Yes, but the "observability" should be sort lived, since empty is virtually guaranteed to be followed by "front" anyways. If both front/empty do the same (lazy) operation on the stream, then whether or not empty was called isn't really "observable" (to a certain extent).

In contrast, having front completly fail if empty was NOT called, means "empty" has a hell of a lot of observable side effect.

Reply via email to