Live data from Hacker News

Replace CoffeeScript with ES6

robots.thoughtbot.com

21–30 of 178 posts

Re: Replace CoffeeScript with ES6

#22
post #13

Note that self = this is kind of a legacy hack for binding 'this'. ES5 has Function.bind https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...

If you want to call something that increases performance by 50% a hack, feel free, but I'm going to use that hack until that's not the case.

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?

Re: Replace CoffeeScript with ES6

#23
post #14
post #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 a…

It's also possible folks will continue forking and improving CoffeeScript so that it keeps up with future releases of vanilla js (which is actually what I hope will continue to happen). Folks like me who come from a Ruby / Python background really don't like brackets and declaring variables, so things like Coffeescript, LiveScript, CoCo, etc. are wonderful tools even despite their occasional moments of weakness. That…

I almost feel like the coffeescript variants are where the action is.

Re: Replace CoffeeScript with ES6

#24
The reason that I like CoffeeScript is that it removes, what I consider, the unnecessary boilerplate of JavaScript and replaces it with a shorthand equivalent and good conventions. I feel that CoffeeScript is better at representing the intent of JS than JS. I can visually sift through CoffeeScript and understand the code much quicker than normal JavaScript, which in my opinion leads to more maintainable code. I'm not certain what is appealing about reading and writing more code for the same result.

Many people don't like that CS needs to be compiled. I don't see this as an issue since pretty much every application I work on these days is concatenated and uglified. So adding a JS compiler is already part of most JS application's build process. 6to5 is being compiled to ES5 anyway. Also, if you include in your build pipeline a source mapper, debugging is not a problem.

Re: Replace CoffeeScript with ES6

#27
post #19

Earlier quoted context omitted.

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

In my experience all non-trivial frontend project I've worked on have ended up with some kind of build step (minification, linting, concating, ect), with or without a compile2JS language. This isn't an issue for node projects as you can simply `require` the `coffee-script/register` module and node handles coffee scripts for you via normal `requires`.

You don't actually need a build step for either in development. Any client-side loader can compile your CS code on the fly.

Re: Replace CoffeeScript with ES6

#28
post #22
post #13

Earlier quoted context omitted.

If you want to call something that increases performance by 50% a hack, feel free, but I'm going to use that hack until that's not the case.

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

Re: Replace CoffeeScript with ES6

#29

Earlier quoted context omitted.

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.

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.

Re: Replace CoffeeScript with ES6

#30

ES6 has 'let', while CoffeeScript has an '=' that might be local binding and might be nonlocal assignment, depending on what's in scope. I wanted to like CS, but I don't want to live with that one decision.

Same here, after I learned about "lexical scoping" in college I couldn't imagine using a language without it.
Post reply on HN