7 ms·
The i is scoped differently in clojure than in golang so it doesn't have the same potential pitfall. I think golang people consider their scoping here a mistak
by hueyp 13y ago
The i is scoped differently in clojure than in golang so it doesn't have the same potential pitfall. I think golang people consider their scoping here a mistake (and have tooling to check it?).
- pcwalton 13y agoThe Go race detector will generally catch this mistake at runtime.
- frou_dh 13y agoC# had the exact same pitfall and it was recognised years ago. It's unfortunate that it made it in to Go.
- shakesbeard 13y agoDid they introduce a language solution for it in C#?
- deleted 13y ago[deleted]
- jared314 13y agoC# 5.0 is changing the behavior of the loop variable to be logically inside the loop [0]. [0] https://news.ycombinator.com/item?id=3477629 https://news.ycombinator.com/item?id=3477629
- VMG 13y agoAlso see Javascript's IIFE: http://en.wikipedia.org/wiki/Immediately-invoked_function_expression#Evaluation_context http://en.wikipedia.org/wiki/Immediately-invoked_function_ex...