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
-1
u/showellshowell Dec 23 '11 edited Dec 23 '11
There is no rolling of dice here. There is no "you don't know". You do know. The scope of "x" is well defined in CoffeeScript, and it's entirely lexical and predictable.
Same x everywhere:
Different x everywhere:
You are correct that "locality" is compromised for some narrow concept of locality. The ultimately prevent-you-from-shooting-yourself-in-the-foot programming language would scope variables to a single line. Then we'd never, ever have naming collisions. ;)