CoffeeScript 1.7 is shaping up to be a pretty kick-ass release with significant improvements. Here are the ones I'm most excited about, in order of my own excitement. ## Parentheses-free chaining https://github.com/jashkenas/coffee-script/pull/3263 *Years* of being wished for, finally granted! ```coffee result = range 1, 3 .concat range 4, 6 .map (x) -> x * x .filter (x) -> x % 2 is 0 console.log result # [4, 16, 36] ``` ```coffee $ 'body' .click (e) -> $ '.box' .fadeIn 'fast' .addClass '.active' .css 'marginRight', '10px' ``` ## Proper multiline strings These two both solve roughly the same problem: https://github.com/jashkenas/coffee-script/pull/3246
https://github.com/jashkenas/coffee-script/pull/3256 These'll finally let you wrap long strings (e.g. user-facing messages) without breaking your code's indentation, or manually stripping newlines out. I've been wanting these for so long! ```coffee if true if not false console.log ' Hello world. This is a long line of text that I’d like split in my code. ' # equivalent to: if true if not false console.log 'Hello world. This is a long line of text that I’d like split in my code.' ``` ```coffee console.log ''' By default, prefixed CSS will rewrite original files. If you didn't set input files, autoprefixer will \ read from stdin stream. Output CSS will be written to stdout stream on \ `-o -' argument or stdin input. ''' # equivalent to: desc = ''' By default, prefixed CSS will rewrite original files. If you didn't set input files, autoprefixer will read from stdin stream. Output CSS will be written to stdout stream on `-o -' argument or stdin input. ''' ``` ## Expansion in array destructuring https://github.com/jashkenas/coffee-script/pull/3268 The name sounds confusing, but this is straightforward: ```coffee # to get the first and last, what you have to do today: [first, middle..., last] = array # what you can do now: [first, ..., last] = array ``` But here's the killer use for it: ```coffee # what you have to do today to get the last element in an array: last = array[array.length - 1] # or if you, like me, like to use features to their fullest: [last] = array[-1..] # what you can do now: [..., last] = array ``` ## New mathetmatical operators https://github.com/jashkenas/coffee-script/pull/2887 - Power operator `**` - Floor division operator `//` - Correct modulo operator `%%` (respects negatives) I remember wishing for each one of these when I worked on [Seadragon Ajax](https://github.com/aseemk/seadragon-ajax)! ## Whitespace escaping in heregexes https://github.com/jashkenas/coffee-script/pull/3214 Not a huge deal to most people, but I've frequently wondered about this. ```coffee regex = /// ` executes `index.coffee` now https://github.com/jashkenas/coffee-script/pull/3292 Like the title says. This brings the `coffee` executable closer in line with `node`. There's still a little [room for improvement](https://github.com/jashkenas/coffee-script/pull/3292#issuecomment-31406660) (e.g. if your main file is named `app.coffee`), but this is already a great step forward. # Credits Phew! Talk about a powerful list. My undying gratitute to the contributors of the above pull requests. A special shout-out to [@xixixao](https://github.com/xixixao) in particular for contributing about half of them! Thank you all very, very much. Looking forward to CoffeeScript 1.7!