Created
July 1, 2011 11:16
-
-
Save Gozala/1058332 to your computer and use it in GitHub Desktop.
Variable shaddowing in coffee is to a problem!
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
(function() { | |
foo(function() { | |
var a1, a2; | |
a1 = void 0; | |
a2 = null; | |
return bar(function(value) { | |
a1 = value; | |
a2 = value; | |
return value; | |
}); | |
}); | |
}).call(this); |
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
# variable shadowing is not really a problem in coffee, | |
# you just need to be explicit, that you don't want to shadow it! | |
foo -> | |
a1 = undefined # long version | |
a2 = null # shorter (that I use personally) but not exactly same | |
bar (value)-> | |
a1 = value | |
a2 = value | |
value |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment