Why does inputRangeObject fail to derive correctly for RandomAccessInfinite ranges?

D Lark dlark at example.com
Sat Jul 16 12:43:12 UTC 2022


On Saturday, 16 July 2022 at 08:40:10 UTC, D Lark wrote:
> On Wednesday, 13 July 2022 at 01:40:43 UTC, Paul Backus wrote:
>> On Wednesday, 13 July 2022 at 01:23:35 UTC, D Lark wrote:
>>> First, please can someone clarify if the behaviour I expect 
>>> in the last line is consistent with the intention of the 
>>> library?
>>
>> Yes, it should behave the way you expect. The current behavior 
>> is a bug.
>>
>> I've submitted a report for it here: 
>> https://issues.dlang.org/show_bug.cgi?id=23242
>
> It looks like the resolution is that this can't be fixed? I'm 
> not sure I understand the conclusion. What does this mean for 
> this part of the library then? Should the 
> RandomAccessInfinite!E interface be removed since it's not 
> fully supported?

What if infinite-ness is a class/struct level property distinct 
from empty-ness like  `const enum bool infinite`? It appears to 
me that this is what we try to achieve by the unfortunate 
coupling of declaring `empty` as a manifest constant to denote an 
infinite range. If we have a distinct convention for declaring 
infiniteness then for the infinite range case we can insert `bool 
empty(){return false;}` (or `const enum bool = false)` 
automatically or check agreement. We can even have a mixin like 
the `ImplementLength` one that can add both `infinite` and 
`empty` in one go, which might be useful for implementing 
infinite ranges.


More information about the Digitalmars-d-learn mailing list