Created
July 23, 2011 12:02
-
-
Save vlasovskikh/1101352 to your computer and use it in GitHub Desktop.
Local vars in CoffeeScript are nonlocal sometimes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
f = -> | |
x = 2 | |
x = 1 | |
> console.debug "x = #{ x }" | |
x = 1 | |
> console.debug "f() = #{ f() }" | |
f() = 2 | |
> console.debug "x = #{ x }" | |
x = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
x = 1 | |
f = -> | |
x = 2 | |
> console.debug "x = #{ x }" | |
x = 1 | |
> console.debug "f() = #{ f() }" | |
f() = 2 | |
> console.debug "x = #{ x }" | |
x = 2 |
Then this might be more relevant:
http://blog.ssokolow.com/archives/2011/05/07/a-python-programmers-first-impression-of-coffeescript/
If you are interested in the pro/contra of scoping: jashkenas/coffeescript#1121
@autotelicum Thanks for these very relevant links! :)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@autotelicum Yep, I'm aware of the scoping rules in CoffeScript, but they are a little bit weird from a pythonista's perspective. Thanks for the pointer to your book!