state of ranges

Seb seb at wilzba.ch
Tue Dec 12 18:40:51 UTC 2017


On Tuesday, 12 December 2017 at 18:32:11 UTC, Luís Marques wrote:
> What's the current state of the range specification?

-> https://dlang.org/phobos/std_range_primitives.html#isInputRange

> For instance, do we have to call empty before calling front?

Spec: "r.front can be legally evaluated if and only if evaluating 
r.empty has, or would have, equaled false."

> Can front provide different answers each time (e.g. map)?

Spec: "r.front evaluated multiple times, without calling 
r.popFront, or otherwise mutating the range object or the 
underlying data, yields the same result for every evaluation."

> Were these kinds of issues resolved or not?
> Is Phobos respecting some consensual protocol or are there 
> still gotchas?

Yes, otherwise please open a bug.



More information about the Digitalmars-d mailing list