Forward ranges in Phobos v2

Dukc ajieskola at gmail.com
Mon Nov 1 13:51:32 UTC 2021


It seems we're going to do Phobos v2. I don't know whether it 
will be the idea Andrei just published or something else, but 
anyway.

So I think it's the time to discuss, do we want to change the 
definition of forward ranges? It seems to be the 
[consensus](https://forum.dlang.org/thread/ztgtmumenampiobbuiwd@forum.dlang.org?page=1) that it's current API is error-prone to use correctly.

For example, we could define that a range that does not offer 
`save()` is still a forward range if it can be copy constructed, 
and that copy constructors for reference ranges would be 
forbidden. But one big problem with that: classes can not be 
ranges then.

At the very least, I think we must take the stance that all 
Phobos v2 ranges must be save-on-copy where the documentation 
does not explicitly declare them reference ranges.

Ideas?


More information about the Digitalmars-d mailing list