6 ms·
> Loop variables with closures indeed a brutal footgun but will be fixed soon
by 0zemp2c 3y ago
> Loop variables with closures
indeed a brutal footgun but will be fixed soon
- sapiogram 3y agoHave they actually agreed on how to fix this now?
- typical182 3y agoEffectively yes. A fix for the loop variable closure problem is now in the official proposal process, which is how language changes happen in Go. It’s a concrete proposal from the core Go team and seems to be on track for acceptance: https://github.com/golang/go/issues/60078 https://github.com/golang/go/issues/60078 An implementation is already available on tip and in the upcoming Go 1.21 release behind a GOEXPERIMENT flag. The community reaction has been extremely positive. As one approximate measure, an earlier draft of the proposal had 671 upvotes and with 0 downvotes: https://github.com/golang/go/discussions/56010 https://github.com/golang/go/discussions/56010