2 ms·
:( That's because Go chose to reuse the loop variable in each iteration instead of binding a fresh one each time. C# figure out that was a mistake years ago a
by munificent 9y ago
:(
That's because Go chose to reuse the loop variable in each iteration instead of binding a fresh one each time.
C# figure out that was a mistake years ago and fixed it in 5.0 [1]. Dart has always bound a new variable in each iteration. I don't know why Go made the choice they did.
[1]: https://blogs.msdn.microsoft.com/ericlippert/2009/11/12/closing-over-the-loop-variable-considered-harmful/ https://blogs.msdn.microsoft.com/ericlippert/2009/11/12/clos...