Re:More Gotchas of Defer in Go, Part II
by knorker on Thursday December 21, 2017 @02:19PM
(#15981910)
I don't feel that it's in more poor form than the solution suggested in the article:
This shadows `i` pretty much the same amount as what I wrote. If `i` gets a different name inside the lambda, then it'd also be worse because then you could accidentally use `i` still.
[ Parent
| on HN ]
Re:More Gotchas of Defer in Go, Part II
by tylersmith on Thursday December 21, 2017 @02:42PM
(#15982120)
I personally prefer the version presented in the article, but your version has at least one nice feature in that you can cleanly specify at the top of the loop body which variables are being shadowed.