News for hackers. Stuff that matters.
Re:You Can Throw() Anything in JavaScript – and Other Async/... by samatman on Friday April 08, 2022 @08:32AM (#30956074)
I happen to be working on an application which is largely written in Lua and uses the same event loop (libuv) as Node.

I can confirm that with careful engineering, application code doesn't have to suffer from the color problem. Fundamentally the trick is to yield after creating a callback, and resume into that callback when the thread has more data to process. A `foo:bar():baz():bux()` chain can pause execution in any of those methods and the user doesn't have to know which (some knowledge of whether this will happen /at all/ is required, only because you need a coroutine since Lua can't yield the main thread).

This isn't built-in, need to start with something like BEAM for that, but it's a nice sweet spot.

There are no comments on this comment yet.