r/programming • • Jul 25 '13

CoffeeScript's Scoping is Madness

http://donatstudios.com/CoffeeScript-Madness
207 Upvotes

315 comments sorted by

View all comments

Show parent comment

-8

u/tiglionabbit Jul 26 '13

No. It's exactly like Ruby.

That is, it forbids shadowing except for function arguments.

23

u/mernen Jul 26 '13

With the extremely important caveat that in Ruby standard variables can never cross method boundaries. You need a constant, a global or a class variable for that, which are all syntactically different and live in their own namespaces.

0

u/tiglionabbit Jul 26 '13

The CoffeeScript developers seem to have modeled all functions in JavaScript after blocks in Ruby. There was no need for additional syntactic distinctions.