Live data from Hacker News

Replace CoffeeScript with ES6

robots.thoughtbot.com

31–40 of 178 posts

Re: Replace CoffeeScript with ES6

#31
I wonder if ES6+ is going to become the new HTML5 - all these great features but no hope of proper browser support for years. I had no idea ES7 was also in development, so it seems like browsers are always going to be playing catchup. The comments on an article here the other day said people aren't upgrading tablets as often as phones. I can see a lot of tablets being stuck on ES5, that people don't want to upgrade, as they can still browse the Facebooks and Googles fine.

Re: Replace CoffeeScript with ES6

#32
post #29

Earlier quoted context omitted.

I'm not sure that's a convincing argument – you will in almost every conceivable case have a build pipeline in place anyway, so there's not really a cost there.

I don't set up a "build pipeline" until I'm sure the app is going to deployed to a production environment. Why would I set up a build for what is essentially a fiddle, or if I'm just experimenting? The now-common workflow where people write build scripts at the start of a new project is just bizarre to me.

Sure, and why do people use C anyway? You can write binary directly without any kind of make utility.

Re: Replace CoffeeScript with ES6

#33
post #28
post #22

Earlier quoted context omitted.

Do you have a source? I don't understand how a closure over a single variable (this), instead of reassigning the value of the variable in a specific scope, would result in a 50% improvement in performance. Also -- the phrase "50% improvement in performance" itself is kind of dubious, no?

I wrote a simple benchmark, and `bind` seems to be mind-boggling slow. http://jsperf.com/self-this-vs-bind

You can write your own or use lodash's for a dramatic speed increase. You can even stomp on Function.prototype.bind.

Re: Replace CoffeeScript with ES6

#35
Mmmm without drastic syntax changes?

Classes:

    There is no semicolon after the function name
    The function keyword is omitted
    There are no commas after each definition
Interpolation:

    `${1 + 1}` 
Multi line strings:

     ` Now we have a 3rd
       string delimiter`
Fat arrow:

    $("button").on("click", () => { 
      // really? hanging parens? no function keyword?
    });
Destructuring:

    var [first, , last] = [1, 2, 3]
    // thats a var to assign vals inside an array
    // and just two commas touching to ignore a value

The whole post is about drastic syntax changes. The brackets are optional in coffeescript.

Besides coffeescript is just a tool.

Re: Replace CoffeeScript with ES6

#37
post #2

Why not both? This makes a good argument for ES6, but CoffeeScript's fundamental changes to syntax are just preferred by some.

Some reasons why I will stick with CS: * Optional braces and parenthesis. Results in visually cleaner and more compact code, especially when dealing with large objects. * Requiring backticks to do string interpolation seems like an ugly hack. * CS uses dots to slice and splice ranges: host?.split(".")[-1..][0] == "dns" BTW, notice in the example above two additional CS features that don't exist in ES6: * The existent…

I looked at 6to5 and started re-writing a few files of CoffeeScript in ES6. First impression was not great. I'd forgotten how many curly braces are required in JS. ES6's fat arrow is just not as nice as CoffeeScript's (required parentheses, no option for thin arrow). I'll no doubt try it out again soon, but I'm not a convert yet.

Re: Replace CoffeeScript with ES6

#38

I wonder if ES6+ is going to become the new HTML5 - all these great features but no hope of proper browser support for years. I had no idea ES7 was also in development, so it seems like browsers are always going to be playing catchup. The comments on an article here the other day said people aren't upgrading tablets as often as phones. I can see a lot of tablets being stuck on ES5, that people don't want to upgrade,…

Firefox and IE11 already natively implement a majority of new ES6 features, and Chrome is getting there:

http://kangax.github.io/compat-table/es6/

The main laggard for now is Safari/WebKit.

Re: Replace CoffeeScript with ES6

#40
post #2

Why not both? This makes a good argument for ES6, but CoffeeScript's fundamental changes to syntax are just preferred by some.

Some reasons why I will stick with CS: * Optional braces and parenthesis. Results in visually cleaner and more compact code, especially when dealing with large objects. * Requiring backticks to do string interpolation seems like an ugly hack. * CS uses dots to slice and splice ranges: host?.split(".")[-1..][0] == "dns" BTW, notice in the example above two additional CS features that don't exist in ES6: * The existent…

'is' is also very cool: makes it harder to write '=' instead of '=='
Post reply on HN