Ranges, constantly frustrating
Jakob Ovrum
jakobovrum at gmail.com
Fri Feb 14 04:29:49 PST 2014
On Friday, 14 February 2014 at 12:10:51 UTC, Regan Heath wrote:
> FWIW I disagree. I think it's immediately and intuitively
> obvious what 'i' should be when you're foreaching over X items
> taken from another range, even if you do not know take returns
> another range. Compare it to calling a function on a range and
> foreaching on the result, you would intuitively and immediately
> expect 'i' to relate to the result, not the input.
>
> R
How should it behave on ranges without length, such as infinite
ranges?
Also, `enumerate` has the advantage of the `start` parameter,
which usefulness is demonstrated in `enumerate`'s example as well
as in an additional example in the bug report.
I'm not yet sure whether I think it should be implemented at the
language or library level, but I think the library approach has
some advantages.
More information about the Digitalmars-d-learn
mailing list