Paradigm | Multi-paradigm: prototype-based, functional, imperative, scripting |
---|---|
Designed by | Jeremy Ashkenas |
Developer | Jeremy Ashkenas, Colin Runciman, et al. |
First appeared | December 13, 2009 |
Stable release |
1.12.2 / December 16, 2016
|
OS | Cross-platform |
License | MIT License |
Filename extensions | .coffee, .litcoffee |
Website | coffeescript |
Influenced by | |
Haskell, JavaScript, Perl,Python,Ruby, YAML | |
Influenced | |
MoonScript, LiveScript |
CoffeeScript is a programming language that transcompiles to JavaScript. It adds syntactic sugar inspired by Ruby, Python and Haskell in an effort to enhance JavaScript's brevity and readability. Specific additional features include list comprehension and pattern matching.
CoffeeScript support is included in Ruby on Rails version 3.1 and Play Framework. In 2011, Brendan Eich referenced CoffeeScript as an influence on his thoughts about the future of JavaScript.
On December 13, 2009, Jeremy Ashkenas made the first Git commit of CoffeeScript with the comment: "initial commit of the mystery language." The compiler was written in Ruby. On December 24, he made the first tagged and documented release, 0.1.0. On February 21, 2010, he committed version 0.5, which replaced the Ruby compiler with a self-hosting version in pure CoffeeScript. By that time the project had attracted several other contributors on GitHub, and was receiving over 300 page hits per day.
On December 24, 2010, Ashkenas announced the release of stable 1.0.0 to Hacker News, the site where the project was announced for the first time.
Almost everything is an expression in CoffeeScript, for example if
, switch
and for
expressions (which have no return value in JavaScript) return a value. As in Perl, these control statements also have postfix versions; for example, if
can also be written after the conditional statement.
Many unnecessary parentheses and braces can be omitted; for example, blocks of code can be denoted by indentation instead of braces, function calls are implicit, and object literals are often detected automatically.