Skip to content

Instantly share code, notes, and snippets.

@tomekwojcik
Created April 14, 2011 12:36
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 tomekwojcik/919386 to your computer and use it in GitHub Desktop.
Save tomekwojcik/919386 to your computer and use it in GitHub Desktop.
Not so cool at all.
CoffeeScript:
end = ->
test = (x) ->
console.log(x)
end()
test2 = (x, y) ->
x + y
end()
JavaScript:
(function() {
var end, test;
end = function() {};
test = function(x) {
console.log(x);
return end;
};
}).call(this);
Problems:
1. Ugly,
2. You'd lose the "return last statement" feature of CoffeScript. end() returns undefined and that's a problem in test2.
Solution:
Add a noop keyword so CoffeScript code would be:
test2 = (x, y) ->
x + y
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment