Skip to content

Instantly share code, notes, and snippets.

@Gozala
Created July 1, 2011 11:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Gozala/1058332 to your computer and use it in GitHub Desktop.
Save Gozala/1058332 to your computer and use it in GitHub Desktop.
Variable shaddowing in coffee is to a problem!
(function() {
foo(function() {
var a1, a2;
a1 = void 0;
a2 = null;
return bar(function(value) {
a1 = value;
a2 = value;
return value;
});
});
}).call(this);
# 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