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
4
u/chrisdoner Dec 23 '11 edited Dec 23 '11
In other words, Lua is lexically scoped like C, JavaScript, Scheme, Python, Ruby, Haskell, etc.
More notable and worrying for me is the fact that Lua will allow you to use an undeclared variable (which will be assumed to be global and whose value will be nil) and it won't complain. So:
Lua is kind of crappy.1 But then, assigning to an undeclared variable is “fine” in Python, JS, and Ruby. So there are scoping problems everywhere. I just discovered that Dart gets scoping right (they seem to have learned from Scheme where Python, JS and Ruby authors did not).
1: I don't even know why people use Lua, or why it was invented (well, I do, “We did not consider LISP or Scheme because of their unfriendly syntax,” their words—idiots—they continue, “the language should avoid cryptic syntax and semantics.” Stupid, stupid); Scheme has always been a viable, far superior, small and powerful language.