CoffeeScript 1.7 has been released with new features requested by developers.
CoffeeScript is described as stable and mostly finished, but this new release does add some new features. In a post on Github about the new version, its creator Jeremy Ashkenas describes the changes (in his own "order of excitement"), starting with support for chaining without parentheses. Until now, you had to use a parenthesis if you wanted to chain functions, as shown in the following example:
This can now be written as:
The new release has also added better support for multiline strings, with the ability to wrap long strings such as user-facing messages without breaking your code's indentation, or manually stripping newlines out.
Another improvement is support for expansion for array destructuring. This was the longest open issue on CoffeScript. Until now, if you wanted to get the first and last elements of an array, you’d have to use:
[first, middle..., last] = array
The new version lets you just use
[first, ..., last] = array
Likewise, if you want to get the last element in an array in the current version, you’d use:
last = array[array.length - 1]
The new version lets you use:
[..., last] = array
New mathematical operators have been added in the form of a Power operator (**), floor division operator (//), and a modulo operator that respects negatives (%% ).
The 1.7 release is available on the CoffeeScript site and on Github.