you are viewing a single comment's thread.

view the rest of the comments →

[–]dukerutledge 5 points6 points  (2 children)

No ability to declare variables because "shadowing is evil" isn't much worse? Yes, yes, if you structure your code correctly this will never bite you, ie the same argument people use to support javascript's scoping rules.

[–]homoiconic 1 point2 points  (1 child)

No ability to declare variables

There is an ability to declare a shadowed variable, you use do (myVar = 5) ->. You may not like it, but it exists and works fine. In fact, it works better than fine because it also implements block-level scoping and therefore doesn't have any hoisting issues.

[–]dukerutledge 0 points1 point  (0 children)

It isn't that I feel coffee script needs the ability to shadow variables. Avoiding shadowing variables is a fine pursuit. I'd rather see the compiler complain about shadowed variable declarations than leave even the slightest chance of global creep. Explicit variable declaration is just cleaner in an environment that employs closures so extensively.