Forward ranges in Phobos v2

Dukc ajieskola at gmail.com
Wed Nov 3 11:30:58 UTC 2021


On Wednesday, 3 November 2021 at 02:34:00 UTC, Steven 
Schveighoffer wrote:
> On 11/2/21 8:11 AM, Dukc wrote:
>
>> - We also add some other function, or perhaps a flag to 
>> aforementioned one, that can convert any v1 input ranges to v2 
>> input range. `valueRange` as default must not accept 
>> non-forward ranges, because then it cannot guarantee that the 
>> result will be a value range.
>
> How does phobos v2 view a non-class non-forward v1 range? This 
> is the fundamental problem needing solving, because if you make 
> copyability the defining trait, current v1 input-only ranges 
> (e.g. `File.byLine`) are going to be miscategorized.
>
> -Steve

They are v2 input ranges. v2 input ranges are not required to be 
value ranges, but should be if they can (meaning, if their v1 
equivalent would be a forward range).

The reason I said that `valueRange` by default must not return a 
reference range is because it'd conflict with the function name.


More information about the Digitalmars-d mailing list