News for hackers. Stuff that matters.
Re:Node.js callbacks vs. promises vs. generators vs. async-a... by fancyfacebook on Sunday March 04, 2018 @03:48PM (#16516625)
About two years ago I opened up a smallish JS file (~100 lines ) and it contained 47 promises, some on the same line.

That was the day I decided JS had gotten way too far up it's own ass and abandoned my career in web development. Every day that goes by makes it seem like a better and better decision.

Re:Node.js callbacks vs. promises vs. generators vs. async-a... by HyperMassive on Sunday March 04, 2018 @04:14PM (#16516789)
> That was the day I decided JS...

Why? surely having 47 promises and some on the same line is the authors fault?

Promise.prototype.then()'s callback function does not need to be written inline. At some point the author should have realised it hass become difficult to grok quickly and refactored them out using appropriate function names.

Re:Node.js callbacks vs. promises vs. generators vs. async-a... by SamReidHughes on Sunday March 04, 2018 @04:03PM (#16516706)
If you're doing I/O in an event loop it's either 47 promises or 47 callbacks.
Re:Node.js callbacks vs. promises vs. generators vs. async-a... by wheresvic1 on Sunday March 04, 2018 @04:30PM (#16516882)
> About two years ago I opened up a smallish JS file (~100 lines ) and it contained 47 promises, some on the same line.

This is exactly what async await is trying to simplify :)

Re:Node.js callbacks vs. promises vs. generators vs. async-a... by gitgud on Sunday March 04, 2018 @08:45PM (#16518088)
Is there an actual reference for this? Sounds like it was minified or just bad coding style. Which can happen in any language.
Re:Node.js callbacks vs. promises vs. generators vs. async-a... by ziikutv on Sunday March 04, 2018 @06:18PM (#16517427)
Here's hoping it gets even better in future so they can win us both back ;)

---

Great article OP. Thank you very much. I remember using Bluebird and sharing the sentiments of the comment which I am replying to.

Re:Node.js callbacks vs. promises vs. generators vs. async-a... by wheresvic1 on Monday March 05, 2018 @03:34AM (#16519624)
You're welcome! It's funny because I actually wanted to practice some inkscape and some infographic making abilities.

Still a long way to go but I'm happy that the content is also appreciated!