On 06/14/2017 12:22 PM, Steven Schveighoffer wrote:

> foreach(i, v; hashmap) => i is counter, v is value
>
> Later hashmap adds support for iterating key and value. Now i is key, v
> is value. Code means something completely different.
>
> Compare with
>
> foreach(i, v; hashmap.enumerate)
>
> Intent is clear from the code.
>
> -Steve

Then, perhaps we're arguing in favor of

* writing .enumerate even for slices (implying that automatic indexing for them has been a historical artifact and code that wants to be portable should always write .enumerate)

* making sure that enumerate() on arrays don't bring extra cost

Ali

Reply via email to