Hacker News new | ask | show | jobs
by kansface 4684 days ago
This is possible if the language supports coroutines like python (see twisted's inline callbacks) or my port to Lua for Luvit: https://github.com/kans/luvit-inlineCallbacks.

Personally, I think raw callbacks are the right thing 95% of the time. yield/async/coroutines are needed for branching async logic where otherwise you'd be forced to make a new function for each branch and deal with the spaghetti at the end.