foreach

Manu via Digitalmars-d digitalmars-d at puremagic.com
Thu Jun 12 22:27:24 PDT 2014


On 13 June 2014 14:14, Steven Schveighoffer via Digitalmars-d
<digitalmars-d at puremagic.com> wrote:

>> Some forward ranges don't have a known length, and can only be summed
>> by an iteration sweep.
>
>
> http://dlang.org/phobos/std_range.html#.walkLength

That's inefficient, I might as well perform the iteration while I'm
walking. No need for a whole pre-pass.

Anyway, you don't need to show me how to work-around the issue. Of you
think I'm not capable of figuring out workarounds myself, then I'm
rather insulted.
The point is, it's crappy, I see no real reason not to support
foreach(; range) or foreach(range), it is already precedented by
for(;;) (I was initially surprised by inconsistency, I'm sure I'm not
alone). I was just throwing it out there as a thought.


More information about the Digitalmars-d mailing list