Rust switches to external iteration
Jonathan M Davis
jmdavisProg at gmx.com
Thu Jul 4 12:26:31 PDT 2013
On Thursday, July 04, 2013 20:23:01 Peter Alexander wrote:
> To be fair, most of the time all you want to do is iterate over
> the range, so while they aren't powerful, they are sufficient
> most of the time.
ll pure input ranges are really good for is simple iteration, because it's
_frequently_ the case you need at least a forward range in order to do much in
the way of algorithms with ranges, so unless you're just not using
std.algorithm and its ilk much, I don't see how you could possibly think that
pure input ranges weren't anything but annoying. There's just so limiting in
comparison to every other range type that I think that they should be avoided
as much as possible.
Sometimes, you're stuck, because the nature of the type that you're dealing
with forces it to be a pure input range, but you just can't take advantage of
many algorithms with pure input ranges, which means that you have to write a
lot more code or use std.array.array in order to use the various algorithms,
forcing you to allocate when it should be completely unnecessary.
If all you're doing with ranges is iteration, then you're under-utilizing them
IMHO.
- Jonathan m Davis
More information about the Digitalmars-d
mailing list