BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News CoffeeScript 2 Released, Adding Modern JavaScript Features

CoffeeScript 2 Released, Adding Modern JavaScript Features

Leia em Português

This item in japanese

After a year of intense activity, CoffeeScript has risen from the embers with CoffeeScript 2, updating the language for use in a modern JavaScript community.

In a blog post announcing the release, Geoffrey Booth wrote that CoffeeScript 2 hopes to bring the language up to speed for modern uses:

This new release of the CoffeeScript language and compiler aims to bring CoffeeScript into the modern JavaScript era, closing gaps in compatibility with JavaScript while preserving the clean syntax that is CoffeeScript’s hallmark.

When CoffeeScript was first in use, ECMAScript 2015 hadn't been released and so the language didn't have class definitions and arrow functions (=>). The concepts were heavily used in CoffeeScript and allowed JavaScript developers the ability to think in terms that weren't yet available in JavaScript. But times have changed and those features now exist in plain JavaScript. Because CoffeeScript 2 generates modern JavaScript output, class and => output as is. Other features added to CoffeeScript include:

  • modules
  • async functions
  • default parameter values
  • object destructing

After a flurry of activity and community head space, CoffeeScript had languished. Hacker News user srb- wrote that, "as a CoffeeScript fan, things were looking pretty bleak a year or two ago. In particular there was zero momentum for new features."

Jeremy Ashkenas, the creator of CoffeeScript, says that "But for the folks who still do [use CoffeeScript] — or have existing codebases — this update is for you". While interest in the language faded over time, CoffeeScript did influence the modern JavaScript we have today. Brendan Eich, the creator of JavaScript, wrote that the ES6 fat arrow functions were "inspired in part by CoffeeScript".

In an interview with InfoQ, Booth says he's happy with the results:

I think CoffeeScript is in a good place. It’s not the phenomenon of a few years ago, but that’s a good thing: now it can focus on being the cleaner JavaScript, and ECMA can focus on language features. CoffeeScript is still popular enough and supported enough to be used for any project, and that was our goal with CoffeeScript 2.

Rate this Article

Adoption
Style

BT