Live data from Hacker News

Decaffeinating a Large CoffeeScript Codebase Without Losing Sleep

eng.datafox.com

1–10 of 47 posts

Re: Decaffeinating a Large CoffeeScript Codebase Without Losing Sleep

#4
post #3

Plain vanilla JS (and therefore TypeScript) still lacks one killer feature from the Coffee family: Null propagation operators (`a ? b` => `a != null ? a : b`, `a?.x` => `a == null ? null : a.x`, etc). Even C# has it.

I agree, it's one of the features we'll miss.

There is a Stage 1 Null Propagation proposal: https://github.com/tc39/proposal-optional-chaining

Re: Decaffeinating a Large CoffeeScript Codebase Without Losing Sleep

#6
post #3

Plain vanilla JS (and therefore TypeScript) still lacks one killer feature from the Coffee family: Null propagation operators (`a ? b` => `a != null ? a : b`, `a?.x` => `a == null ? null : a.x`, etc). Even C# has it.

Given null is generally non-idiomatic in JS (it's there, but most best practices say to avoid it) I think that's likely by design.

However the `a?.b` form is coming (it's not just null propagation, it's an Existence Operator). It's called "optional chaining"

https://github.com/tc39/proposal-optional-chaining

Re: Decaffeinating a Large CoffeeScript Codebase Without Losing Sleep

#8

It's pretty wild having seen CoffeeScript spread like a wildfire in the early 2010s, only to be discarded nearly as fast a couple years later.

It validates my policy of not jumping on every new thing.

I loose "nerd cred" for it, but it's better for my clients that way.

Re: Decaffeinating a Large CoffeeScript Codebase Without Losing Sleep

#9
This article is missing one important thing: CoffeeScript now supports native import and export statements, but decaffeinate doesn't. I recently migrated several large codebases and had to escape all the import and export statements (which wasn't very hard), but it got a little hairy where we were directly exporting instead of assigning it to a variable first.

I'm going to miss CoffeeScript, but being able to use ES7 features (notably async/await) is worth it.

Re: Decaffeinating a Large CoffeeScript Codebase Without Losing Sleep

#10

It's pretty wild having seen CoffeeScript spread like a wildfire in the early 2010s, only to be discarded nearly as fast a couple years later.

Yes, I had the feeling this had to do with the rise of Nodejs. Back in 2010 I was mostly a PHP dev and some Nodejs devs told me how cool and better it is and that there is CoffeeScript, which is also much better than JavaScript and PHP combined.

I also started a JS project in 2015 were the lead dev started 3 months before me with... CS! But he rewrote most of it in ES2015.

Post reply on HN