You are very stubbornly distinguishing the fact that CoffeeScript has lexical scoping from the rules for how new scopes are introduced.
The way new variables are introduced, not scopes! That's the point. The rules for scoping are extremely simple and are strictly lexical, while the syntax for variable definition is frustratingly ambiguous.
And I think it's a bit harsh to call somebody "stubborn" for sticking to the facts. I'm not going to concede that CoffeeScript doesn't have lexical scoping because it is an objective fact that it does. If somebody kept insisting that Python has dynamic scoping because it lets you define new variables in the middle of method bodies, would you concede that?
I think that's a drawing an awfully thin line and it's not at all unreasonable for "CoffeeScript's scoping" (as in the title of the article) to refer to both.
I guess, in the same way that it's reasonable for "apple pie" to refer to a parakeet simply because there's a pie in the same room as a parakeet. I think it's being awfully lazy with language to use the sentence "CoffeeScript doesn't have lexical scoping" to mean "CoffeeScript's syntax doesn't readily distinguish definition from reassignment." I don't see how it's unreasonable to draw a distinction between those two, given that they mean completely different things if you use the standard CS definitions of the words involved.
Like, if you don't like the way CoffeeScript does things, more power to you. I'm not arguing with that. I just want the criticism to be about things that are actually true.
If you don't think that variable declarations are part of the scoping system of a language, well, that's quite strange to me (what else are they for, then?) but I have no interest in arguing that point.
The "thing described in the blog post" is that you cannot tell from the body of a function whether a variable used in it is local to that function or belongs to a wider scope. You seemed to claim above that this was "exactly the same behavior as Common Lisp". I don't believe this is the case.
View all comments
Show parent comment
1
u/PaintItPurple Jul 26 '13 edited Jul 26 '13
The way new variables are introduced, not scopes! That's the point. The rules for scoping are extremely simple and are strictly lexical, while the syntax for variable definition is frustratingly ambiguous.
And I think it's a bit harsh to call somebody "stubborn" for sticking to the facts. I'm not going to concede that CoffeeScript doesn't have lexical scoping because it is an objective fact that it does. If somebody kept insisting that Python has dynamic scoping because it lets you define new variables in the middle of method bodies, would you concede that?
I guess, in the same way that it's reasonable for "apple pie" to refer to a parakeet simply because there's a pie in the same room as a parakeet. I think it's being awfully lazy with language to use the sentence "CoffeeScript doesn't have lexical scoping" to mean "CoffeeScript's syntax doesn't readily distinguish definition from reassignment." I don't see how it's unreasonable to draw a distinction between those two, given that they mean completely different things if you use the standard CS definitions of the words involved.
Like, if you don't like the way CoffeeScript does things, more power to you. I'm not arguing with that. I just want the criticism to be about things that are actually true.