Live data from Hacker News

Replace CoffeeScript with ES6

robots.thoughtbot.com

1–10 of 178 posts

Re: Replace CoffeeScript with ES6

#3
Yes and no. Although we get some fantastic features, one of the most critical- the ability to neglect parens and curly braces- is lost in es6. I'm working on an es6 project right now and still prefer coffeescript.

Re: Replace CoffeeScript with ES6

#4
post #3

Yes and no. Although we get some fantastic features, one of the most critical- the ability to neglect parens and curly braces- is lost in es6. I'm working on an es6 project right now and still prefer coffeescript.

For functions of single arguments, you parameter list parens are optional.

But it's not an objective fact that coffeescript's syntax is better. I prefer ES6. And even if you prefer coffeescript, it seems strange to claim that the most critical feature is purely aesthetic.

Re: Replace CoffeeScript with ES6

#6
post #2

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

Because one day ES6 will run in browsers without a build step.

Is that a major concern? In practice, it's unlikely any serious use of ES6 will run in a browser without a build step due to concatenation, minification etc

Re: Replace CoffeeScript with ES6

#7
I give credit to CoffeeScript with really helping to push the ES specs forward and think it helped introduce more people to JS and grow the ecosystem. Heck, I used it for a year, liked it, and had it change some of my approaches to writing JS.

That said, I hope it slowly fades into the background as more people go back to vanilla ES6 or go with something more powerful such as TypeScript (or Flux). With the progress around es6 and es7, gradual typing, macros, and other tooling around the language, I think CoffeeScript risks becoming a drag on getting people to learn modern JS and instead sticking with a language that has a lot of ambiguous constructions and fewer and fewer advantages over JS.

Re: Replace CoffeeScript with ES6

#8
post #2

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

Because one day ES6 will run in browsers without a build step.

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.

Re: Replace CoffeeScript with ES6

#9
post #3

Yes and no. Although we get some fantastic features, one of the most critical- the ability to neglect parens and curly braces- is lost in es6. I'm working on an es6 project right now and still prefer coffeescript.

That's interesting - personally I've always really disliked that about Coffeescript. It may just be because of how familair I am with C-family languages, but I always liked the default Javascript style far better.

So from my perspective ES6 is the best of both worlds - the better syntax of Javascript and the features that Coffeescript gave you.

Re: Replace CoffeeScript with ES6

#10
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 existential operator `?` soaks up null/undefined references.

* `==` is compiled to `===`

* Expressions always return a value in CS, just like in Lisp, so no need to explicitly `return`

* Block strings and regular expressions.

And more: http://coffeescript.org/

Plus, CS just seems like it's always a step ahead of JS. In using it, you can code in a more intelligently designed language that enforces best-practices better than JS does. Doing so supports diversity, innovations (after all, many of these ES6 features are obviously inspired by CS).

Why abandon such a wonderful language when it still has so much to offer, and at the same time seems to be driving innovation in JavaScript itself?

Post reply on HN