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
1
u/jashkenas Dec 23 '11
Yes, it would be awfully nice to make it explicit -- but unfortunately it's unspecified by JavaScript, and so different engines work in different ways. In the browser, you want to export your API to the "window", but not if you're using RequireJS, and not if you're on the server, in which case you want to use the "exports" object.
These things all behave in meaningfully different ways, so it's not something we can paper over.