Skip to content

Instantly share code, notes, and snippets.

@Spaceghost
Created February 17, 2014 18:04
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 Spaceghost/9055820 to your computer and use it in GitHub Desktop.
Save Spaceghost/9055820 to your computer and use it in GitHub Desktop.
Why I hate Coffeescript.
a = undefined # var a;
a = "lol" # a = 'lol';
rawr = (-> # rawr = function() {
a = "wat" # var a = 'wat';
a # return a;
).call() # }.call();
console.log a # console.log(a);
# returns 'wat' # returns 'lol'
# What the fucking fuck, Coffeescript...
@ajmurmann
Copy link

Wait, I am totally confused. Do I see this right that with "returns" you mean that that's what the console.log prints not what the return value of rawr would be if called? If that's the case then the coffee version makes absolutely no sense. Not only did they break variable scope, but also method invocation/definition. It's so broken, I am not even sure what they broke.

@Spaceghost
Copy link
Author

@ajmurmann, it's showing that coffeescript doesn't use var within function definitions. They don't like var.

// Generated by CoffeeScript 1.7.1
(function() {
  var a, rawr;

  a = void 0;

  a = "lol";

  rawr = (function() {
    a = "wat";
    return a;
  }).call();

  console.log(a);

}).call(this);
// Generated by CoffeeScript 1.7.1 with --bare
var a, rawr;

a = void 0;

a = "lol";

rawr = (function() {
  a = "wat";
  return a;
}).call();

console.log(a);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment