Forward ranges in Phobos v2

Paul Backus snarwin at gmail.com
Wed Nov 3 14:17:48 UTC 2021


On Wednesday, 3 November 2021 at 11:54:24 UTC, Dukc wrote:
> There's an easier solution: require all v2 ranges to have the 
> `inputRangeTag`. For forward ranges it must be set to false, 
> but if the tag does not exist at all then it isn't a v2 range.
>
> If we go for this, I'd rename the tag to `isReferenceRange` 
> though.
>
> It's going to require more manual usage of the `valueRange` 
> wrapper though, as the v1 ranges around aren't going to be v2 
> ranges as often.
>
> What do you say?

Sure, that would work. But that still leaves the issue of `const` 
ranges, which is the other thing `head` and `tail` are meant to 
address.

I think if we are going to make incompatible changes to the range 
API, we might as well do a proper redesign that fixes all of the 
known issues at once. And until we do that (maybe in v3?), it is 
probably better to hold off on incompatible changes.


More information about the Digitalmars-d mailing list