News for hackers. Stuff that matters.
Re:CoffeeScript 1.7.0 by tieTYT on Tuesday January 28, 2014 @04:35PM (#7139912)
> Leading . now closes all open calls, allowing for simpler chaining syntax.

I feel like this is an important improvement, but I don't really understand what it means. Can someone elaborate on what this means and how it works? How did things used to be different?

Re:CoffeeScript 1.7.0 by xixixao on Tuesday January 28, 2014 @04:40PM (#7139946)

  result = range 1, 3
    .concat range 4, 6
    .map (x) -> x * x
    .filter (x) -> x % 2 is 0
For example, the leading `.map` closes the open call to `range` and the open call to `concat`. Before 1.7.0, `.map` would be called on the number 6.
Re:CoffeeScript 1.7.0 by bobbyi_settv on Tuesday January 28, 2014 @04:40PM (#7139954)
It would have been nice if their code example for this feature showed how the code would have looked in the prior version of Coffeescript.
Re:CoffeeScript 1.7.0 by xixixao on Tuesday January 28, 2014 @04:51PM (#7140013)

  $('body')
  .click (e) ->
    $('.box')
    .fadeIn('fast')
    .addClass '.active'
  .css 'background', 'white'
If I omit as many parentheses as possible. Also for the other example:

  result = range(1, 3)
    .concat(range 4, 6)
    .map((x) -> x * x)
    .filter (x) -> x % 2 is 0
Re:CoffeeScript 1.7.0 by ndnichols on Tuesday January 28, 2014 @04:48PM (#7139994)
It would look like

    result = range(1, 3).concat(range 4, 6).map((x) -> x * x).filter (x) -> x % 2 is 0
or

    result = range 1, 3
    result = result.concat range 4, 6
    result = result.map (x) -> x * x
    result = result.filter (x) -> x % 2 is 0
Re:CoffeeScript 1.7.0 by rayshan on Tuesday January 28, 2014 @04:45PM (#7139974)
Instead of this: $ 'body' .click (e) -> $ '.box' .fadeIn 'fast' .addClass '.active' .css 'marginRight', '10px'

You used to have to do this: $('body') .click (e) -> $('.box') .fadeIn('fast') .addClass('.active') .css 'marginRight', '10px'

Note the extra ( )s, if not used, the next method call is not recognized as a method call but rather part of the previous call's argument. The last method call did not and does not need to be closed with ( ).

This is hugely important for libraries like d3 with super long call chains.