Thread overview
Why does is the RandomAccessInfinite interface not a valid RandomAccessRange?
Dec 18, 2021
D Lark
Dec 19, 2021
Paul Backus
Dec 19, 2021
D Lark
Dec 19, 2021
Bastiaan Veelo
Dec 19, 2021
MoonlightSentinel
December 18, 2021

The following assertion fails:

assert(isRandomAccessRange!(RandomAccessInfinite!int));

Whereas this one passes:

assert(isRandomAccessRange!(RandomAccessFinite!int));

I have compiled this using dmd v2.098.0.

Can someone please tell me if this is expected behaviour and what the reasoning is behind this choice?

December 19, 2021

On Saturday, 18 December 2021 at 19:48:00 UTC, D Lark wrote:

>

Can someone please tell me if this is expected behaviour and what the reasoning is behind this choice?

Looks like a bug. I've filed a report on the D issue tracker:

https://issues.dlang.org/show_bug.cgi?id=22608

December 19, 2021

On Sunday, 19 December 2021 at 00:07:46 UTC, Paul Backus wrote:

>

On Saturday, 18 December 2021 at 19:48:00 UTC, D Lark wrote:

>

Can someone please tell me if this is expected behaviour and what the reasoning is behind this choice?

Looks like a bug. I've filed a report on the D issue tracker:

https://issues.dlang.org/show_bug.cgi?id=22608

Thanks and thanks for the speedy fix. Being new to D, I could not tell if it was some design choice imposed by "infiniteness".

Do you know if there's a nightly version I can specify to use your fix?

December 19, 2021

On Sunday, 19 December 2021 at 09:19:31 UTC, D Lark wrote:

>

Do you know if there's a nightly version I can specify to use your fix?

Are you inheriting from RandomAccessInfinite? Then you can probably add

static if (__VERSION__ < 2099)
    enum bool empty = false;

to make it work.

— Bastiaan.

December 19, 2021

On Sunday, 19 December 2021 at 09:19:31 UTC, D Lark wrote:

>

Do you know if there's a nightly version I can specify to use your fix?

Nightly builds are available at https://github.com/dlang/dmd/releases/tag/nightly.