News for hackers. Stuff that matters.
Re:More Gotchas of Defer in Go, Part II by pcwalton on Thursday December 21, 2017 @01:23PM (#15981392)
Shadowing can be useful if you want to make sure the "old" variable is never referenced again in the same scope.

The reason why this idiom feels "weird" is that the loop construct of the language really ought to automatically make a fresh instance of the loop counter for each trip through the loop.

There are no comments on this comment yet.