On Tuesday, 3 June 2014 at 13:30:13 UTC, Steven Schveighoffer
wrote:
There is a school of thought (to which I subscribe) that says
you shouldn't allocate a separate closure for each loop
iteration.
Basically, a closure will only use the stack frame of the
calling function, not any loop iteration.
This way, you can clearly delineate what scope the closure has,
and avoid unnecessary allocations.
This is already a level too deep - it closes over variables, not
the stack frame. And from this point of view, the current
behavior is clearly wrong, because there is a different variable
in each iteration; it just happens to have the same name.