r/programming • u/zumpiez • Dec 22 '11
The Problem with Implicit Scoping in CoffeeScript
http://lucumr.pocoo.org/2011/12/22/implicit-scoping-in-coffeescript/
83
Upvotes
r/programming • u/zumpiez • Dec 22 '11
View all comments
Show parent comment
2
u/munificent Dec 23 '11
Right, but in Dart you get a fresh
ifor each loop iteration.It's a bug. We have two loops: C-style and
for-in. I believe that with the latest spec, both create fresh loop variables for each iteration. The VM does the right thing here. DartC (which is what "Try Dart" uses) and frog (the new Dart->JS compiler which will eventually replace Dart) don't. They do the right thing withfor-inloops, but not C-style for loops.Yeah, I think so, but only if you declare the variable inside the loop. I think this is more consistent with
for-inloops, and the fact that those don't create fresh variables each time is a very frequent source of confusion for people. (I believe Eric Lippert described it as the most frequently-reported bug in C# that isn't a bug.)