News for hackers. Stuff that matters.
Re:Go: Redefining For Loop Variable Semantics by kjeetgill on Tuesday October 11, 2022 @03:37PM (#33168190)
I've always referenced this as one of the subtle points of genius for how Java did lambdas:

by requiring captured variables to be final it removes a lot of ambiguity around what a variable name refers to. If you do want crosstalk between the inner and outer scopes you have to be more explicit and introduce a reference to talk through.

I love python, but I basically avoid this construction and use a single element list if I need it. I can never remember exactly how it works.

There are no comments on this comment yet.