r/coffeescript • • Jul 26 '13
Is CoffeeScript's Scoping Madness..? (x-post from /r/programming)
/r/programming/comments/1j1cw7/coffeescripts_scoping_is_madness/
6
Upvotes
r/coffeescript • • Jul 26 '13
6
u/scrogu Jul 26 '13
This comes up weekly. I've been using coffeescript for over a year and have never, ever had a single problem with scoping.
Your code should be written in small modules. There is an outer scope, and then functions are all nested inside this, usually assigned to the exports object. Occasionally you nest one function inside another for a closure, but I have no idea how or why you would nest functions so deep or make your file so huge that you lose track of outer scoped variables.
It is more important to me that they make loop conversions to arrays explicit and provide the option to name functions for debugging purposes when appropriate.
1
u/[deleted] Jul 26 '13
I've just recently begun looking into CoffeeScript and tried it out, but haven't yet used it in a project.. This lexical scoping issue raises a couple of questions for me..
variable,letordeclarein the CS language be such a huge deal..? or would it go against what CS is about..?