Live data from Hacker News

Replace CoffeeScript with ES6

robots.thoughtbot.com

101–110 of 178 posts

Re: Replace CoffeeScript with ES6

#101

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.

> Chrome is getting there

They are busy with that other programming language.

Re: Replace CoffeeScript with ES6

#102

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...

It can also be nice when you're writing instance methods on a prototype. for instance: var Person = function(name) { var self = this; self.name = name }; Person.prototype = new function() { var prototype = this; prototype.sayHello = function() { var self = this; return "Hello\n\n-- " + self.name; }; }; var me = new Person('Peter'); console.log(me.sayHello()); Obviously that's a pretty contrived example but it illustr…

I don't like `var self` at all and I find there are vanishingly few places where you can't just bind a function appropriately, but one important thing to note, if you do go down this route, is that `self` is an alias for the `window` object, so if you happen to miss out that `var self` assignment at some point, you may get unexpected results.

On that basis, if you must do this, I would suggest `var _this`, `var scope` (though that would probably be confusing if you had the misfortune to be using Angular), `var me` (unless you happen to find anthropomorphism distasteful) or... well, anything other than `var self`, really.

Re: Replace CoffeeScript with ES6

#103
post #100

Earlier quoted context omitted.

I sure hope you're wrong. The unnecessary clutter of plain JS is just painful to look at. I can't remember how many times I've looked over a 40 line block of JS searching for a missing. When there are many )} )}; } ; } ; } -- it is just downright frustrating to be be wasting any time on what is effectively irrelevant syntax. With CS, it's indent and be done with it. It's like SASS vs. SCSS. Or Haml vs. ERB. I can't,…

> "With CS, it's indent and be done with it" As others have said, it's all fun and games until two people edit the same source file, one of whom has the dangerously incorrect opinion that tabs are better than spaces :-) I use a lot of semantic whitespace languages (CS, Haskell, Python), and it's a tradeoff: you gain in terms of redundancy, true, but there's an additional human overhead of making sure everyone's got t…

...two people edit the same source file, one of whom has the dangerously incorrect opinion that tabs are better than spaces

Commit hooks will help you:

http://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks

The bigger your team, the more you need them.

Re: Replace CoffeeScript with ES6

#104
The "all or nothing" with CS has always been a non starter for me. I find it really hard to believe that it is possible for a team of more than 2 or 3 to remain happy with a choice to use it after any extended period of time. If you're out there though, I would love to hear from you!

And yes, this can be said for almost any tool choice, but my spidey sense tells me the half life for CS is about that of something like Jira.

Re: Replace CoffeeScript with ES6

#105
There is very few features of ES6 that are not syntax sugar.

Those features will be (or already are) ported to CoffeeScript.

And the CoffeeScript sugar is just tastier.

ES6 syntax is kind of CoffeeScript for people who hate meaningful indentination and it's quite decent for that purpose.

Re: Replace CoffeeScript with ES6

#106

There is very few features of ES6 that are not syntax sugar. Those features will be (or already are) ported to CoffeeScript. And the CoffeeScript sugar is just tastier. ES6 syntax is kind of CoffeeScript for people who hate meaningful indentination and it's quite decent for that purpose.

> There is very few features of ES6 that are not syntax sugar.

(Weak)Map, (Weak)Set, Symbol, Generators, Promises, Modules, Proxies... these aren't sugar.

Re: Replace CoffeeScript with ES6

#107

Earlier quoted context omitted.

Why add unnecessary clutter?

Lisp programmers would love to disagree

Parenthesis are not unnecessary in Lisp they're an essential delimiter in defining an s-expression's structure (does not need to be parenthesis but some token is required).

But for me that one bit of syntax is a lot less that the multitude required for many languages.

For something even more syntactically minimal there is Forth.

Re: Replace CoffeeScript with ES6

#108
post #74

Earlier quoted context omitted.

> you should never, ever be debugging a problem on live Until you have to

Then you've done it wrong. Very, very wrong. You should be able to replicate your live environment locally and not being able to is a sign of a very broken development process. I just cannot emphasise this enough. One of my skills is debugging, everywhere I've worked I've been one of the top debuggers if not the top debugger. Never, ever debug on live. If you can't recreate the problem locally, you don't understand t…

> Then you've done it wrong. Very, very wrong. You should be able to replicate your live environment locally and not being able to is a sign of a very broken development process.

I feel this is statement is a tad hyperbolic.

One of my key skill sets is debugging, I'm pretty good at it. One of the things we can't do is completely replicate a production environment because we're a web hoster. Sure I can run and test stuff against our OS "gold images" but when you've added third party client code running on 300-400 sites on a single server that environment is not reproducible without a herculean effort. We also don't have the luxury of time to "Keep trying to replicate it until you do. I'm talking days of trying".

Four or five times a year I need to dig out ADPlus, point it at a customer's worker process and tell it to snapshot and dump when certain conditions/triggers occur. I then whip said dump over to my WinDbg+SOS environment to find out what the hell was happening in the process when it went bad.

Re: Replace CoffeeScript with ES6

#109

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…

The things I hate most about CoffeeScript are the dash rockets and white-space significance. These are just opinions though. There are things I like about CS as well, like destructuring assignment and splats. Sometimes when I'm writing JS, I miss is, unless, etc... That said, I'd put my money on ES6 in the long run, though it doesn't really matter. People should use whatever makes them (and their team) happy and prod…

I want to love whitespace significance, but after hitting refactoring pain points many times in Python, Coffeescript, and Sass/Less/Stylus, at this point I believe the brackets are worth their redundancy.

Re: Replace CoffeeScript with ES6

#110
post #92

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…

Ex-Coffeescript ,now Javascript with lot's of Python experience guy here. The "I understand CS code much quicker" argument is a valid one theoretically, but In my opinion, it does not hold up practically that well. CS got one thing wrong that Python got right: There are many ways to do things. When writing CS, I understood MY CS just fine... but it always took me longer to understand the CS of other people. Sometimes…

As an example that I deal with daily, writing React components in CoffeeScript v.s. Javascript really highlights the elegance of CoffeeScript.

Of course you can reduce the JS verbosity with JSX instead... which again is introducing a pre-processor to the mix (one I personally am not a fan of, but w/e).

ES6 adds some sweet stuff for sure, but IMO it doesn't make JS a pleasure to work with yet (which seems to be the argument?).

I'm willing to bet it's not going to reduce the count in this list by much. https://github.com/jashkenas/coffeescript/wiki/list-of-langu...

I'm comfortable writing either as I'm sure many are, but when given the choice I opt for CoffeeScript.

P.S. Good luck telling someone using ClojureScript that they should switch back to Javascript.

Post reply on HN