News for hackers. Stuff that matters.
Re:Golang landmines by amscanne on Sunday September 18, 2016 @01:47PM (#12526243)
So does Go (use the first form).

Saying "loop variables are scoped outside the loop" is incorrect.

All the gotchas noted stem from the fact that people are using _closures_ in the form of go and defer statements, which capture i by reference unless you pass it as an argument.

I think it's more an issue with closure gotchas (or the fact that go and defer statement aren't viewed that way) than with scoping.

Re:Golang landmines by amscanne on Sunday September 18, 2016 @10:17PM (#12528370)
(Whoops, I mean _second_ form.)