4 ms·
After everything, CoffeeScript is for people who hate JavaScript. It isn't, though. It's for people who want to use a variant of JavaScript with less syntax su
by untog 12y ago
After everything, CoffeeScript is for people who hate JavaScript.
It isn't, though. It's for people who want to use a variant of JavaScript with less syntax sugar, which is exactly what the start of the post says.
And the example of a single function does make it look like CoffeeScript is a waste of time. However, I love it when working with promises. What used to be:
promiseFunc()
.then(function(a) {
return doSomething(a);
})
.then(function(b) {
return doAnotherThing(b);
})
becomes:
promiseFunc()
.then -> doSomething(a)
.then -> doSomething(b)
I could go through the various benefits that CoffeeScript provides, but the site already does that. And at the end of the day, people can do whatever they want. If you want to use CoffeeScript, do. If you don't, don't. But don't say that CoffeeScript users "hate JavaScript".
- mrjaeger 12y agoFor correctness and to make the comparison more fair, the compiled CS is actually: promiseFunc() .then (a) -> doSomething(a) .then (b) -> doSomething(b)
- untog 12y agoWhy would I be reading the compiled code?
- BerislavLopac 12y agoActually, in this exact case the better Javascript example would be: promiseFunc().then(doSomething).then(doAnotherThing)
- untog 12y agoWell, sure. This is what happens when I over simplify an example.