Rust switches to external iteration
Jonathan M Davis
jmdavisProg at gmx.com
Thu Jul 4 12:33:23 PDT 2013
On Thursday, July 04, 2013 11:37:15 H. S. Teoh wrote:
> if a function
> only needs to iterate the range once, then it should only require an
> input range, nothing more.
Agreed, but it's freuently the case that an input range isn't enough, and even
if it is for a particular function, odds are than the result of that function
is going to need to be fed to another function which _does_ require more than
an input range. And far too often, it's the case that people think that an
input range is enough when in fact a forward range is required, but the
implicit save that many ranges do makes it so that the function works without
calling save much of the time, even though it really does need to save.
Whenever I have to deal with pure input ranges, I find it to be extremely
annoying. The simple fact that you can't even save its state is just way too
limiting for a lot of algorithms to be able to be implemented in any kind of
sane way, if at all, and too much of Phobos becomes unavailable either because
what it's trying to do just can't be done with an input range or because it
would consume the range when you can't afford for it to be consumed.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list