News for hackers. Stuff that matters.
Re:Show HN: Decaffeinate converts CoffeeScript projects to m... by yojo on Monday June 19, 2017 @12:31AM (#14584645)
ES6 has eliminated most (though not all) of the pain Coffeescript solved. I work on a large code base that went from Coffeescript -> Typescript (mostly manual, some decadfeinate), and typesafety has been a huge boon for our developers. For smaller teams/codebases, you might be happy sticking with Coffeescript.
Re:Show HN: Decaffeinate converts CoffeeScript projects to m... by xiaoma on Monday June 19, 2017 @04:42AM (#14585418)
I see ES6 or especially Typescript as essentially a recreation of ES4/Flash AS3, with some renaissance-era Javascript footguns attached. You've got classes, various class based OO features, optional typing major industry support, probably improved performance coming soon, etc...

Coffeescript was a bit different. It meant fewer lines of code, not more. It had significant whitespace and some other Python-inspired idioms like array comprehensions and object comprehensions. Most importantly, Coffeescript was a new language and didn't have to re-implement deleterious Javascript features like the == vs === distinction, undeclared vars leaking to global scope, baroque keywords like "with", etc...

That said as others have pointed out, ES6 did borrow many good features from CS and CS is slowly dying. Fortunately other languages like Elm and, to a lesser degree, Reason have offered even more compelling "footgun free" alternatives.

Re:Show HN: Decaffeinate converts CoffeeScript projects to m... by masklinn on Monday June 19, 2017 @06:58AM (#14585938)
> It had significant whitespace and some other Python-inspired idioms like array comprehensions and object comprehensions.

Modern JS has standard HoFs (on arrays) and an iteration protocol.

> undeclared vars leaking to global scope

Strict mode (which syntactic ES6 features enable by default e.g. class contents are in strict mode always).

> baroque keywords like "with"

Which can trivially be linted away.

> ES6 did borrow many good features from CS

Not really from CS, rather from similar (much older) sources CS got them from.

Re:Show HN: Decaffeinate converts CoffeeScript projects to m... by xiaoma on Monday June 19, 2017 @11:07AM (#14587508)
HoFs are not array comprehensions and array comprehensions aren't supported in ES6.

https://gist.github.com/sleepyfox/1879845

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...

Re:Show HN: Decaffeinate converts CoffeeScript projects to m... by masklinn on Monday June 19, 2017 @11:58AM (#14587908)
> HoFs are not array comprehensions and array comprehensions aren't supported in ES6.

Neither of these is a claim I made so I'm not sure why you feel the need to point these out.

However native HoF obviate much of the need for comprehensions, especially combined with terser "arrow functions". Languages like Smalltalk or Ruby do just fine without comprehensions for instance.

Re:Show HN: Decaffeinate converts CoffeeScript projects to m... by maxscam on Tuesday June 20, 2017 @12:41AM (#14592250)
If you quote the fact that coffeescript has significant whitespace, list comprehension and then in response say that javascript has HoF and iteration protocol, it does sound like youre trying to counter the point, so it seems like for someone to bring up the fact that they are not identical is fair game.
Re:Show HN: Decaffeinate converts CoffeeScript projects to m... by Eridrus on Monday June 19, 2017 @08:45AM (#14586452)
I inherited a coffeescript codebase a few years ago and found that it had footguns of its own due to a weak transpiler.
Re:Show HN: Decaffeinate converts CoffeeScript projects to m... by mavdi on Monday June 19, 2017 @07:47AM (#14586171)
You're looking at the wrong bits. ES6 has delivered vast FP improvements and awesome async support.
Re:Show HN: Decaffeinate converts CoffeeScript projects to m... by masklinn on Monday June 19, 2017 @08:35AM (#14586404)
The only async support in ES6 were standardised promise objects and arrow functions (which cleanup the callback-heavy promise-based code). As well as extensive promisification of browser API but that's not directly ES6.
Re:Show HN: Decaffeinate converts CoffeeScript projects to m... by striking on Monday June 19, 2017 @09:13AM (#14586648)
Uh, did you notice the "async"/"await" keywords?

EDIT: My mistake. I learned something today.

Re:Show HN: Decaffeinate converts CoffeeScript projects to m... by joshuacc on Monday June 19, 2017 @10:28AM (#14587199)
That's not ES6. It's ES2017, aka ES8.
Re:Show HN: Decaffeinate converts CoffeeScript projects to m... by xiaoma on Monday June 19, 2017 @09:50AM (#14586901)
It's a bit presumptuous to tell me what bits to look at and then tell me about FP improvements when I just recommended Elm :D
Re:Show HN: Decaffeinate converts CoffeeScript projects to m... by jononor on Monday June 19, 2017 @04:18AM (#14585343)
So want typing support in CoffeeScript...
Re:Show HN: Decaffeinate converts CoffeeScript projects to m... by rattray on Monday June 19, 2017 @11:28AM (#14587656)
That was a big part of my motivation in building http://LightScript.org as it was clear that was never going to happen with coffee.

Currently works with Flow syntax, but not yet the actual flow checker - would love help making that happen!

Re:Show HN: Decaffeinate converts CoffeeScript projects to m... by koolba on Monday June 19, 2017 @06:07AM (#14585740)
That'd be particularly difficult as CoffeeScript doesn't have var declarations.
Re:Show HN: Decaffeinate converts CoffeeScript projects to m... by molszanski on Monday June 19, 2017 @11:38AM (#14587747)
Partly. You can define them if you want it. You can even add type support with FB Flow.

CS developers sometimes define variables because of hoisting.

Obviously, variables are defined. In CS they are simply defined for you automatically. That said, you can obviously do it yourself if you want. But you will not be able to use additional tooling around `let` and `const`

Re:Show HN: Decaffeinate converts CoffeeScript projects to m... by jononor on Tuesday June 20, 2017 @04:07PM (#14598107)
Can one use FB flow with CoffeeScript? Comments I saw on github indicated that the CS compiler mangled it, I think due to how functions are named and stripping comments?
Re:Show HN: Decaffeinate converts CoffeeScript projects to m... by molszanski on Monday June 19, 2017 @10:40AM (#14587307)
I personally don't really like types, but I've successfully used FB Flow with CS and it was fine.
Re:Show HN: Decaffeinate converts CoffeeScript projects to m... by jononor on Tuesday June 20, 2017 @04:10PM (#14598131)
Got any docs/writeup for this? Any tips/tricks/hacks?