On Saturday, 16 July 2022 at 12:40:09 UTC, Paul Backus wrote:
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:
[...]

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?

The interface works fine, it's just that the `InputRangeObject!R` instance itself does not satisfy `isRandomAccessRange`:

```d
auto seqObj  = sequence!((a, n) => n).inputRangeObject;
RandomAccessInfinite!size_t seqIface = seqObj;

static assert( isRandomAccessRange!(typeof(seqIface))); // interface passes static assert(!isRandomAccessRange!(typeof(seqObj))); // object fails
```

So if you code to the interfaces and ignore the concrete type of the range object, you should not have any problems.

Thanks this definitely alleviates the issue somewhat.

However it is definitely surprising that an object which literally derives from an interface cannot be tested to implement said interface. Is this inconsistency not a problem?

Reply via email to