Use CoffeeScript! #2472

wants to merge 1 commit into


None yet

Come on guys. Time to upgrade.

@mjackson mjackson Use CoffeeScript!
Come on guys. Time to upgrade.

Do the tests still run? Also, coco is better.


+1, there's no way core can be written in JS. You need these advanced features and only CoffeeScript can provide them.




+1. Now I can actually read Node's source.

kn commented Jan 5, 2012



Dart is so much better, but we should ditch V8 in favor of SpiderMonkey too #lol


-1. Now I can't read Node's source.


+1. Now I am willing to read Node's source.


You were supposed to wait until april 1st to do this!


You should use is instead of == where possible.

tj commented Jan 5, 2012

nom nom


Also, you should omit call parens where possible, looks much better.

@pquerna pquerna closed this Jan 5, 2012

Stop wasting our time.


node core devs cannot into jokes?


"Wasting it with AWESOMENESS" - maccaw


Wha?! Do you realize how much time it took me to port the entire stdlib of node to CoffeeScript? It was so awesome!


@mjijackson Sure you didn't use js2coffee? ;)


15 896 / 6 501 = 2.44516228

I think you need to close this pull request 1.44516228 more times in order to maintain your current level of efficiency.


Worthiness of troll attempt aside, I do find the differences in line counts interesting.


Wow, this didn't last long at all.


How long until this is posted on hacker news I wonder.


@jesusabdullah Char count would probably say more.


@mjijackson Sorry, I have to agree with @pquerna. Not a very well executed troll.

You're too well known of a noder (and not well-known as a crazy idiot), so it's obvious this is a joke. Too obvious to be funny, I'm afraid. It would have been better to start a new github account to do this from, get denied with no explanation, then have Hacker News blow up in flames over how much paul hates open source contributions, and node isn't community-friendly.


@thejh probably.

If nothing else, this is definitely an interesting node/coffee case study, at least assuming he coffeescript is relatively idiomatic and not bizarro-generated.


Hmm, 193440 chars coffee vs 433111 chars JS. And if he had used more cool syntax, it'd probably be even less chars.

Well, code length isn't everything, but I think this does say something.


@isaacs has a point here.
/me goes to create a new account


/me thinks js2coffee needs to become better

Also, we need js2coco.


My eyes are bleeding! hi hi :)


Actually, maybe I can do js2coco...


Regardless of how well known he is, I still thought it was funny~


Regardless of how well known he is, I still thought it was funny~

The real problem is that FTFY coffeescript ports have become passe.


Someone will actually do this now, by hand. I wonder how much shorter the code will be.


Reopen (You don't have permission to reopen this issue)


chilj: 42 minutes :3


eh, who cares


@limeblack: you can make ridiculous looking examples like that in any language. In fact, Jeremy just made one in JS a few minutes ago (no idea why). And they get much, much worse. A convincing argument would be showing something that looks innocent and straightforward, and showing how the compilation differs from what you'd expect. That is a sign of a flawed language. Not saying that CoffeeScript has no flaws, but that your example was not a good one. The CS flaws can be seen in the ~200 issues we have open right now.

edited a little


Last time I checked js2coffee strips out comments. When you take this into account and that you wont have ending curly braces the line count isn't really impressive.



CofeeScript in a simple way

Which of the three Javascript examples does the following generate?

foo -> bar 'foo', -> 'bar'

The point, is that Javascript is simple in demonstrating what are and aren't functions because it has an ending delimiter.

CoffeeScript doesn't have an ending delimiter which increases ambiguity.

Although CoffeeScript functions certainly could be wrapped in paranthesis for clarity, the intended function creation could have been a lot simpler with an ending delimiter.

I'm not against white space significant languages with missing ending delimiters for functionn. In fact Python is great. Python just doesn't have multiline anonymous functions.

Considering having single line anonymous functions isn't an option, having an ending delimiter would be ideal.

Editted added last sentence


Omg, coffeescript



@jesusabdullah that because they have removed all the comments + line breaks. It's not that impressive.


Not that I condone js vs. cs flame wars, but:

I'm not against white space significant languages with missing ending delimiters for function. In fact Python is great. Python just doesn't have multiline anonymous functions.

I've actually researched the reason for this, and the answer as far as I can tell really does boil down to this exactly. Basically, Guido foresaw these ambiguities and decided it was too gross-looking to implement. This later came to be described with the answer, "Multi-line lambdas aren't pythonic."

That said, I'm not sure that this decision really was the lesser of two evils. This is one thing that makes studying CS interesting.


@jesusabdullah that because they have removed all the comments + line breaks. It's not that impressive.

The count is lines total then, not sloc? I guess that makes sense given the context of version control (versus making these sorts of comparisons).

If the coffeescript was more or less the same length as the original javascript I'm not sure I'd find it less interesting. In fact, this sounds like an easy way to measure large-scale differences in coffeescript. If the overall sloc for both ends up being comparable then it could be a strong indicator that coffeescript and javascript themselves are more similar than people may think. Likewise for a very different line count. Of course, this is just one of many dimensions but it's an easy one to deal with.

An idea to make this a more fair comparison: Convert the new coffeescript back to js and see what happens, . I wonder if they reach an equilibrium in the same way human language translations do.

I digress.



ya hear, me. holla




@limeblack what a terrible example... You can have ambiguity in any language, and in any language the coder should avoid ambiguity. Just because you can write terrible ambiguous code in coffee-script (just like any other language), doesn't mean you should or it should be condoned. The great thing in coffeescript vd javascript is that sometimes not using parenthesis is cleaner, and sometimes it isn't - but coffeescript allows the coder to make a decision on that, where JavaScript doesn't.

In short, your example was like complaining knives can kill people, so knives are shit, and that everyone should always use spoons for everything.




@balupton You're forgetting that knives have a purpose as a utensile. CoffeeScript is to JavaScript as a dull knife wrapped in bubble wrap is to a knife.

@limeblack That example was awesome.


@joshkehn How so?

CoffeeScript has a purpose as a language. To be written faster, read better, and look prettier with fewer symbols getting in the way of real words that people understand.


@tylermwashburn I disagree that a language should be designed to “look pretty”. I also disagree that people can only understand “real words” and that “symbols get in the way.” !true reads better (and is written faster) then not true.

It's all a matter of preference I guess. Looking at the number of packages written in CS vs JavaScript I'm not worried about being overrun by CS code at any point in the near future.


@joshkehn I think designing a "pretty" language is a great idea. I'm ocd, so the clean appearance is pleasing to me. Some (read "a lot of") people probably (read "do") prefer the extra symbols though.

I'm not saying that only real words are understandable, but personally I can comprehend the meaning of not true faster than !true. It's just how my brain is wired. And even though it's longer, for some it can still be typed faster than the JS alternative. It's another one of those things that depends on the person though.

You can also pull off a lot of valid English in CoffeeScript, which I like. Such as..

gossip is not true

..or in JS..

gossip === !true
tj commented Jan 6, 2012

why would you write gossip === !true haha.. !gossip?


This is what my language will look like:

if (gossip is not true, seriously, it's not, i promise)

Big Fail! gossip === !true really?
Edit: Oh @visionmedia is faster than me...


@chjj I will require proper capitalization in my language, as well as proper punctuation.

If the variable entitled "gossip" is not true, then...

In addition, any mistakes and it rm -rf's your hard drive.

Node.js Foundation member

you guys do all realize that when you comment on this thread, the terrorists win :)


@mikeal We are only replying so we can send annoying e-mails to everybody who replied in this pull request.



In addition, any mistakes and it rm -rf's your hard drive.

Haskell was close.




I don't see any reason as to why Node.js shouldn't be rewritten in Malbolge. It's the only language that makes sense.


@joshkehn: I disagree that a language should be designed to “look pretty”.

Yeah, Lisp is so much better to read than Ruby!


@trodrigues How about Lua— oh wait...



About lua... something like Love2d in node.js would be awesome.


These coffeescript flamewars/jokes are ludicrous and are becoming a real turn off in the land of javascript.


@antrover nailed it


Port entire node.js std lib to coffeescript?




node is dead anyway. Dart ftw.


@tylermwashburn I don't see how gossip === !true is cleaner then !gossip.

Here is a great one. gossip is weakly true translates to gossip === weakly(true). How do you like this no-symbol syntax?


@visionmedia @alejandromg Technically gossip === !true is not the same as !gossip, the first uses the identity operator and the second implicitly uses the equality operator (thus no type conversion is performed). They will produce different truthiness values when gossip is an empty string for example.

tj commented Jan 6, 2012

@davej in context... that's like people using typeof === 'foo' when it's always a string, you just have to actually use your mind


@visionmedia Sure, I was just pointing out that they are not the same thing and there are instances where !gossip wouldn't be what you want. Personally, I think it's easier just to get into the habit of using === or !== all the time because it's more explicit and less likely to introduce bugs.

tj commented Jan 6, 2012

I think I wouldn't want to use someone's software if they didn't know how to decide between == and ===


I love coffee, but one question, why is EMPTY?


js → coffee → back to js, heh


@davej @visionmedia It's a debate similar to the CS/JS one. Is it better to subsidize the original developer by spending the code maintenance time of future developers, or is it better to spread the cost evenly?

CS wants to gain followers, so promotion of the former benefits make more sense.
JS has a much larger presence in large scale application development (where the costs of maintenance are much more important -- debugging tools/ease, staffing availability, standardized coding conventions, consistent interfaces, actual financial cost...many more), so ignoring those costs rings hollow.


@visionmedia It's not about knowing how to decide between == and ===, it's about saving yourself (and people reading your code) the hassle when === will do what you want. Sure, you can do a few little tricks when you know that null == undefined and 0 == '' but why bother, you're just making your code less understandable for the sake of a few characters.

gf3 commented Jan 6, 2012

@NuckChorris You just reinvented AppleScript.


Learn JavaScript.


Guys, holy fuck. I know how to program. I know !gossip is shorter/cleaner/whatever.

It was an example.


In JS !gossip === shorter/cleaner/whatever


Coffee script is why programmers are disliked amongst our inter-disciplinary colleagues.




9/10 A- would troll again!


-1 no need for code hipsters fad




awesome post


does anyone remember PHP? they argued about backslashes as namespace separators. Bloody amateurs.





This is almost as funny as that time @dhh switched Rails over to CoffeeScript by default.... only he wasn't trolling.


@mjijackson I think that if you're not trolling and are being serious about that, you have all the liberty of forking node and make your own project in CoffeScript based on it.

tj commented Jul 27, 2012

@Denommus it's a troll


I still think we should have waited til april fools for this. I was disappointed when I saw it in january.


js2Coffee (and back)

square = (x) -> x * x
var square;

square = function(x) {
  return x * x;
square = undefined
square = (x) ->
  x * x
var square;

square = void 0;

square = function(x) {
  return x * x;


@renfredxh renfredxh referenced this pull request in halls-of-fame/github Dec 12, 2014

Add Node's "Use CoffeeScript" PR #24

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