Y
Hacker News
new
|
ask
|
show
|
jobs
by
hueyp
4729 days 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?).
3 comments
frou_dh
4729 days ago
C# had the exact same pitfall and it was recognised years ago. It's unfortunate that it made it in to Go.
link
shakesbeard
4729 days ago
Did they introduce a language solution for it in C#?
link
jared314
4729 days ago
C# 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
link
pcwalton
4729 days ago
The Go race detector will generally catch this mistake at runtime.
link
VMG
4729 days ago
Also see Javascript's IIFE:
http://en.wikipedia.org/wiki/Immediately-invoked_function_ex...
link