6 ms·
When I first checked out coffeescript, I had a feeling that Jeremy was unfairly trying to show it off as cool by being less verbose than javascript - a feeling
by bilalhusain 15y ago
When I first checked out coffeescript, I had a feeling that Jeremy was unfairly trying to show it off as cool by being less verbose than javascript - a feeling I found echoed in one of the tweets by Zed. But after actually using it, I realized that I had missed the whole point.
Coffeescript has that ruby-esque intuitiveness. A lot of time I refactor code on a gut feeling that it'll work, coffee -p, yup it does ... 9 out of 10 times. closure, is, in, of, soaking null references lets you focus more on your code rather than on patterns, handling corner cases and avoiding mistakes; and I just discovered the fat arrow thanks to this post. (Yup, the documentation is all there on the homepage but, agree or not, learning is incremental and involves mistakes and serendipity.)
- jashkenas 15y agoDug up Zed's tweet: https://twitter.com/#!/zedshaw/status/101746443949322240 https://twitter.com/#!/zedshaw/status/101746443949322240 ... which does indeed miss the point -- the side-by-side comparison on the homepage is not to show you what the equivalent handwritten JavaScript would be -- it's the actual JS output compiled from the CoffeeScript on the left. More of a "nothing up my sleeves" and no bullshit maneuver. In a perfect world, CoffeeScript would compile into the JavaScript you would have written in the first place -- but that's quite a tall order.
- bilalhusain 15y ago<public_display_of_affection> Dear sir, I'm jumping on my bed right now out of ecstasy, for my unworthy comment has garnered a reception, from a noble soul like yours. You just made by day. In fact, you do it through the means of coffeescript everyday. Thank you for coffeescript, kind sir. Hats off. A broke, insecure, forever alone developer. </public_display_of_affection>
- Cushman 15y agoEspecially since if I had to write that JavaScript by hand, I wouldn't.
- d0m 15y agoSadly, to write good JavaScript, you somewhat need to do that. Of course, you'd use more functions instead of repeating the same patterns over and over.. but there're things you just can't factor out and this is, in my opinion of course, exactly where CoffeeScript shines.
- ori_b 15y agoIf you're doing a side-by-side comparison, then you want to compare with what a human would write, not with what a compiler would write. Otherwise, you're not really showing the advantages of your language, you're showing how easy it is to read the object code -- something that's only really an advantage when debugging your compiler and/or trying to map the generated output back to the source for debugging purposes. I mean, look at what Hello World in C is, compared to Hello World in Haskell! http://pastebin.com/sePpUJ1J http://pastebin.com/sePpUJ1J (Haskell source) http://pastebin.com/seqAy4VD http://pastebin.com/seqAy4VD (C, generated from the Haskell above) Clearly C is unreadable garbage! (It's less expressive than Haskell, for sure, but showing generated output makes it look far worse)
- danielmason 15y ago"What a human would write" isn't the purpose of the comparison. "This gets put in, this comes out" is. Did you not read the heading on the overview page? It doesn't even say "comparison" anywhere. The second paragraph talks at length about how CS compiles to readable Javascript. Then the examples show you that readable Javascript. You're missing the point.
- untog 15y agoI don't think he is- I think he's saying that the point being made is the wrong one. It should be a comparison of the two languages because that's what people would want and expect.
- ori_b 15y agoWhy do I care if the output javascript is readable? It's object code. I don't want to care about it.
- innes 15y agoYou'd only care if you ever needed to interactively debug your app in the browser. So, unless you're a fan of old-school debugging (ie not debugging, just writing out to the console) you do care about how the javascript looks.