opNext: Simplified ranges
Joseph Rushton Wakeling
joseph.wakeling at webdrake.net
Thu Nov 10 15:25:30 UTC 2022
On Sunday, 6 November 2022 at 01:48:04 UTC, Walter Bright wrote:
> We didn't use the "next" protocol for ranges because one cannot
> test for existence of the next element without consuming it.
Aren't there cases (e.g. some kinds of IO) where that's
unavoidable in any case?
The "next" approach is surely the most information-limited case,
where you really can't separate between checking for existence of
the next element, and consuming it. Other possibilities, such as
the presence of a check whether the range is `empty`, or the
possibility to `peek`, would then be less information-limited
options on top of that.
I apologize if I'm out of date on some discussions which have
already taken place around the range design, and so forcing you
to re-explain something that's already been worked through.
More information about the Digitalmars-d
mailing list