Forward ranges in Phobos v2

Andrei Alexandrescu SeeWebsiteForEmail at erdani.com
Thu Nov 4 22:38:30 UTC 2021


On 2021-11-04 12:39, Paul Backus wrote:
> Again, this is the same distinction we already have between rvalue 
> `front` and lvalue `front`

That reminds me, we should drop that like a bad habit too :o).

Currently ranges have all sorts of weird, random genericity. Recalling 
from memory (perhaps/hopefully some of these have been fixed):

- At least at some point `empty` did not have to return bool, just 
something convertible to bool. Like immutable(bool).

- For a while we had a lively discussion about length returning ulong 
instead of size_t (relevant on 32-bit).

- front could return pretty much what it damn well pleased, including 
qualified data, rvalues vs lvalues, noncopyable stuff, etc.

- Thinking how inout interacts with everything ranges is just depressing.

- I seem to recall there was at least one popFront that returned 
something meaningful. (Maybe that's not too disruptive.)

Based on past experience we could and should simplify the range 
interface in places where genericity has little value and the 
implementation effort is high.


More information about the Digitalmars-d mailing list