Rust switches to external iteration
w0rp
devw0rp at gmail.com
Thu Jul 4 11:32:23 PDT 2013
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.
>
> - Jonathan M Davis
InputRanges aren't useless, that's just wrong. When chaining
ranges together, you are locked to the most limited range
available. If you use network IO, database access, and many other
comment tasks, you are left with InputRanges.
While the other range types are certainly more powerful, and a
definite path to take when implementing libraries, like
std.algorithm, sometimes you just don't need all of that power.
Yield is much simpler, and when that's all you need, why
complicate matters?
More information about the Digitalmars-d
mailing list