opNext: Simplified ranges

Per Nordlöw per.nordlow at gmail.com
Sun Nov 6 21:06:01 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.

That's not a blocker if we can afford implementing a second 
function for the "peek" case. This is the path Rust took via its 
`Peekable` trait and `peek()` member as described at

https://doc.rust-lang.org/stable/std/iter/struct.Peekable.html

.


More information about the Digitalmars-d mailing list