CoffeeScript. Is it still worth it?

Yesterday i was reading 10 Reasons to Switch from CoffeeScript to LiveScript and continued to an overview of LiveScript. LiveScript is yet another language that compiles to js.

What i thought was that both CoffeeScript and LiveScript share much in common. They both try to add some features to js. And much of them are already implemented in ES6.

Arrow functions, list comprehensions, destructuring assignment, OOP. All this is featured by both CoffeeScript and LiveScript, and all of this is already or will be soon implemented in javascript itself.

// LiveScript
f = (x) -> x + 1

// CoffeeScript
f = (x) -> x + 1

// ES6
let f = (x) => x + 1

But while these features are ported to ES, they change their syntax and semantics. So you dont have CoffeeScript as superset of js anymore, now you have an incompatible deviation from standard. Both in syntax and semantics. Now, CoffeeScript, LiveScript, and so on, are fragmenting js, making many a little incompatible languages with comparable features.

// CoffeeScript
race = (winner, runners...) ->
  print winner, runners

// compiled ES5
race = function() {
  var runners, winner;
  winner = arguments[0], runners = 2 <= arguments.length ?, 1) : [];
  return print(winner, runners);

// ES6
let race = (winner, ...runners) =>
  print(winner, runners)

In node.js, you may dont even have to compile ES6, because much of it works out of the box.

Typed languages

TypeScript (Microsoft), Flow (Facebook), AtScript (Google, discontinued, now you can hear about something called SoundScript) are different story here. Because they extend js in different way: by adding optional typing. And this optional typing is considered, for example, by Google, to be some day integrated in VM. Being integrated in VM, this type information will allow the JIT-compilers to be better and faster on optimizing javascript. Moreover, the companies are looking for compatible syntax for these notations.

// TypeScript and flow
function hello(name: string) {
  return 'hello, ' + name;

So, here we have strict superset of the current ES, and this typed versions of js are going to have compatible syntax and semantics in the future.

ClosureScript, PureScript etc

One of things that ES unlikely to have is Python-ish indentation or Lisp-y identifiers (like document.query-selector-all in LiveScript). But this is not something ground breaking. It looks more like yet another example of Wadler's law. In my opinion, the profit of using yet another layer of complicated rewriting is more and more questionable here.

However, what i would not consider as fragmentation is languages that are radically depart from js, such as ClosureScript or PureScript. These languages provide something really different from what you have in ES.


So yes, you know all that "the number of errors depend on the number of lines", but SLOCs for many of languages compiling to js are now comparable. So, is it still worth it?

Additional links

From CoffeeScript Back to JavaScript



free hit counters