Replace CoffeeScript with ES6
robots.thoughtbot.com
Replace CoffeeScript with ES6
1–10 of 178 posts
Re: Replace CoffeeScript with ES6
#2Re: Replace CoffeeScript with ES6
#3Re: Replace CoffeeScript with ES6
#4Yes 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.
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
#5Why not both? This makes a good argument for ES6, but CoffeeScript's fundamental changes to syntax are just preferred by some.
Re: Replace CoffeeScript with ES6
#6Why 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.
Re: Replace CoffeeScript with ES6
#7That 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
#8Why 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.
Re: Replace CoffeeScript with ES6
#9Yes 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.
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
#10Why not both? This makes a good argument for ES6, but CoffeeScript's fundamental changes to syntax are just preferred by some.
* 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?