Rust switches to external iteration

H. S. Teoh hsteoh at quickfur.ath.cx
Thu Jul 4 11:37:15 PDT 2013


On Thu, Jul 04, 2013 at 08:23:01PM +0200, Peter Alexander wrote:
> On Thursday, 4 July 2013 at 18:06:51 UTC, Jonathan M Davis wrote:
> >On Thursday, July 04, 2013 19:28:29 w0rp wrote:
> >>I see yield as a tool only for when you only want to create input
> >>ranges easily. There is a definite value in the other range types,
> >>but yield is useful for when you just want to produce an input range
> >>quickly.
> >
> >And given how useless pure input ranges are, I really don't see much
> >value in that. About all they give you is the ability to iterate over
> >a set of values once. The other range types are _far_ more powerful,
> >and pure input ranges should be avoided as much as possible IMHO.
[...]

I disagree. Most of the time you only want to iterate over a set of
values once, and input ranges are perfectly suited for that. I'm a
stickler for requiring the minimum to be functional -- if a function
only needs to iterate the range once, then it should only require an
input range, nothing more.


> 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.

+1. That's not to say other range types aren't useful; they are very
useful (and necessary) in certain contexts. But more often than not,
what I do with a range requires nothing more than an input range.


T

-- 
It's bad luck to be superstitious. -- YHL


More information about the Digitalmars-d mailing list