r/programming • • Dec 22 '11

The Problem with Implicit Scoping in CoffeeScript

http://lucumr.pocoo.org/2011/12/22/implicit-scoping-in-coffeescript/
83 Upvotes

116 comments sorted by

View all comments

Show parent comment

2

u/inmatarian Dec 23 '11

You are right on that one issue, that a lot of languages gets scoping rules wrong. Explicit scoping almost always is better, except for in stuff like small scripts where you never even define a function.

The undeclared variable thing has many solutions. Most basically amount to installing a metatable on the global environment that catches when a nil passes through and treats it as an error.

I like Lua a lot, as its syntax and treatment of closures is very simple. I wish the coroutine stuff (cooperative threading) could be a little simpler (or I wish other languages would adopt the concepts).