Re:Node v7.5.0 Released
by ihsw on Friday February 03, 2017 @08:01AM
(#13559475)
Wrapping every standard library method with my own promises sounds like just another flavour of hell, and it still doesn't address the fact that the standard library is callback hell.
[ Parent
| on HN ]
Re:Node v7.5.0 Released
by always_good on Friday February 03, 2017 @09:01AM
(#13559804)
Callback hell isn't the characteristic of having a callback-based API. It's the code you get when you try to compose it and conditionally fork it without any better abstractions.
So promisifying a callback-based API does address it by either letting you use a yield/await abstraction or at the very least promise composition.
Wrapping a callback-based API is such a mechanical process that you can wrap entire modules at a time, so I'm not sure what's hellish about that when it gives you promises, something you can actually work with.
I agree with you but FWIW there are both big (Bluebird) and small (pinky-promise) packages to promisify stuff.
Re:Node v7.5.0 Released
by WorldMaker on Friday February 03, 2017 @03:22PM
(#13562971)
promise-ring is one library that does the wrapping automatically from node-style callbacks to promises. I think Bluebird also has an auto-wrapper.