Re:The Problem with Implicit Scoping in CoffeeScript
by locci on Thursday December 29, 2011 @09:00PM
(#3406261)
Oh, I see. And you fiddle with globals by manipulating the window/exports object, which I assume are reserved identifiers.
Thanks a lot for clarifying that, it doesn't look that bad this way.
CoffeeScript will automatically declare all variables in the nearest lexical scope it can find. The top-level scope in CoffeeScript isn't global -- it's the top of the file. You don't have to know anything about what values may or may not exist in global scope at any given moment ... all you have to know is what variables are visible in your function's enclosing scopes, just within the file you're working in.