Ranges longer than size_t.max

monarch_dodra monarchdodra at gmail.com
Sat Dec 29 13:18:53 PST 2012


On Saturday, 29 December 2012 at 20:59:56 UTC, Stewart Gordon
wrote:
>
> 5. Don't allow such ranges to define a .length property.
>

I still think there is a fundamental difference between:
5a: Don't allow such ranges to define a .length property.
and
5b: Don't guarantee *support* for such ranges.

The current status quo in phobos is "5b" BTW. There are a few
select algorithms that do support it, but only because the 
implementers decided to go the extra mile, and it usually makes 
things more complicated than it needs to be.

BTW iota, in certain cases, will have a length returned in ulong.
This is used to test *certain* algorithms, but really, nothing is
guaranteed.

At the very least, there was a discussion some time ago that for
a (finite) RA range, range[range.length] must compile. Ditto for
slicing.

This was never enforced though... Which is a shame (IMO)...
...Well, I was the one to suggest that actually, but I never did 
it, so blame falls on me :/

I'll put it back on my todo list.


More information about the Digitalmars-d mailing list