So I think the next *big* step from here, in D3 or some other
D-derived
language, would be easing the creation of ranges. For example, a
special low-boilerplate syntax for creating bidirectional and
random-access ranges. Or for input (or maybe even forward)
ranges, a
C#-style compile-time transformation of a generator function
into a
range (With input ranges, you can technically get around
needing source
transformation right now in D2 using fibers, but that has too
much runtime overhead to be used as a general solution).
I don't think we need language support in order to have an easy
way to create random access ranges. We could have a function that
would be used like this:
auto squares = randomAccessRange(len, (size_t i) => i * i);
This probably wouldn't have optimal performance, but wouldn't be
horribly slow either. Another option would be to have a mixin
that would generate all other range methods from a method that
would provide random access to the initial (that is, before the
first call to popFront or popBack) range and a property that
would return the length of the initial range.