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
5
u/LaurieCheers Dec 23 '11 edited Dec 23 '11
The second example is just ridiculous. :-)
There's no need to make nonlocal references explicit. The only problem we're trying to fix here is that a declaration can get accidentally turned into an assignment.
If you don't like
nonlocal, then I think explicit declaration (the var keyword seems like the obvious choice) is the right solution. You can use that and still forbid shadowing, if you want."Error: cannot declare var x here, x was already declared at line 54."