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/jashkenas Dec 23 '11
That's actually already taken care of. By default, there are no global variables in CoffeeScript -- every file is wrapped in an immediate invoked function, so variables declared at the top level are still local variables.
If you want to export global variables from a CoffeeScript file (which you probably do), you say
window.globalObject = objectin the browser, or use theexportsobject in Node.js.