Re:Modern Javascript: Everything you missed over the last 10...
by macando on Saturday May 15, 2021 @12:54PM
(#27166847)
async await was the biggest breakthrough for me. Made JavaScript code 3x more readable.
[ Parent
| on HN ]
Re:Modern Javascript: Everything you missed over the last 10...
by BenoitEssiambre on Saturday May 15, 2021 @02:58PM
(#27167892)
I really wish when things moved to async/await, that they would have gotten rid of promises like I proposed here: https://es.discourse.group/t/callback-based-simplified-async...
As it stands it's layers of caching, state machines and complexity.
Re:Modern Javascript: Everything you missed over the last 10...
by Sephr on Saturday May 15, 2021 @07:16PM
(#27169818)
Your proposal seems very reminiscent of the generator-based JavaScript async library I created back in 2010:
Re:Modern Javascript: Everything you missed over the last 10...
by Oddskar on Monday May 17, 2021 @12:17PM
(#27185173)
It's building on top of something that developers should be using anyway; or at least have familiarity with. I'm quite glad they ended up going this route for that reason.
Re:Modern Javascript: Everything you missed over the last 10...
by contriban on Saturday May 15, 2021 @01:57PM
(#27167395)
Confirmed. Every time I convert an old Node project to promises I constantly find bugs and situation that were just lost in the hell. The result is also so much cleaner that sometimes you realize you were doing something wrong entirely and you scrap the whole thing. No other JavaScript improvement comes close. Everything else is nice but only saves a few chars at most.
Re:Modern Javascript: Everything you missed over the last 10...
by macando on Saturday May 15, 2021 @02:15PM
(#27167552)
And they announced promises like a big improvement over callbacks :D Now that was hell! Fortunately, when I started doing serious Node.js development, callbacks were already on the way out.
Re:Modern Javascript: Everything you missed over the last 10...
by splendidHaiku on Sunday May 16, 2021 @01:28PM
(#27175322)
For me too. Only thing I sometimes struggle with, is figuring out how to place error catches.
Wrap each async functions body in a try catch? Or always attach a catch handler to the calling function? But what if I forget to do that?
Should the caller or the callee handle the errors or can both?