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
13
u/munificent Dec 23 '11
You still have declaration versus assignment, you just don't have different syntaxes for them.
x = 1may do visibly different things based on the surrounding context which determines whether it's assigning or declaring a new variable, right?Sort of, except:
xmay be different "things".Also, you've lost composability. If I take an isolated chunk of code that isn't accessing any free variables and drop it in the middle of another chunk, its behavior may spontaneously change based on the surrounding context even though it doesn't access that context.
I'm not saying you made the wrong choice here. Implicit declaration may work well for CoffeeScript, and I totally get the desire to simplify. But this is definitely one of the areas of the language that I'm not too crazy about. I like being terse but I still like being explicit.