News for hackers. Stuff that matters.
Re:ECMAScript 6 by pornel on Sunday February 22, 2015 @04:34PM (#9091216)
ES6 is especially nice with D3.js:

    .attr('transform', function(d) { return "translate(" + (d.x + 1) + " 0)"; })
becomes:

    .attr('transform', d => `translate(${d.x + 1} 0)`)
And:

    .attr({x:x, y:y, width:width, height:height})
    
    .attr({x, y, width, height})
Re:ECMAScript 6 by j10t on Sunday February 22, 2015 @05:11PM (#9091406)
I've been writing TypeScript exclusively for so long, I forget most devs are still using the old syntax.
Re:ECMAScript 6 by brianshaler on Sunday February 22, 2015 @05:36PM (#9091525)
Same here, except with CoffeeScript.
Re:ECMAScript 6 by recursive on Sunday February 22, 2015 @07:10PM (#9091846)
But coffeescript doesn't even look like JavaScript. How could you confuse them?
Re:ECMAScript 6 by brianshaler on Tuesday February 24, 2015 @11:39AM (#9101698)
Several ES6 features very much resemble the few ways coffeescript syntax differs from older versions of ecmascript. Arrow functions, destructured assignment, string templates.

In context, we were commenting on this:

    .attr('transform', d => `translate(${d.x + 1} 0)`)
which looks pretty similar to the coffeescript counterpart:

    .attr 'transform', (d) -> "translate(#{d.x + 1} 0)"
Five subtle differences, but it shows how the things that are new/different about ES6 are more similar to typescript and coffeescript than ES5.
Re:ECMAScript 6 by bshimmin on Monday February 23, 2015 @04:12AM (#9093313)
In the specific D3 examples above, the advantages of ES6 have long been available in CoffeeScript.
Re:ECMAScript 6 by lucidrains on Sunday February 22, 2015 @06:56PM (#9091808)
Me too! I love Coffeescript, so glad we can finally build things with ecmascript 6!
Re:ECMAScript 6 by jschrf on Monday February 23, 2015 @02:30AM (#9093095)
Agree. It makes writing functional code (and functional-style code) much better looking.

Careful though: Libraries like jQuery and D3 can and/or do rebind `this` and that can be a gotcha in both TypeScript and straight ES6. You can end up having to mix both declaration styles, which is gross.

Re:ECMAScript 6 by codygman on Sunday February 22, 2015 @09:38PM (#9092270)
Readable lambdas are always a plus for me, glad to see this change.
Re:ECMAScript 6 by ncza on Sunday February 22, 2015 @05:14PM (#9091417)
Oh wow, that is so much more understandable for me! Nice :-)