lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On Sep 30, 2011, at 3:14 AM, Fabien wrote:

I believe that nmap does something like that for its Lua workers; you should check their sources.

Beware though that despite Node.js' hype, callback-driven  APIs quickly turn user code into an unmaintainable spaghetti plate mess.

The antidote to this is coroutine, offering callback performances with normal code readability, and Lua is one of the few languages which properrly supports them.

Coroutines were one of the things that initially drew me to Lua for Lightroom. This makes it surprising that we've ended up not using them on my current project. This wasn't a conscious choice but just how things evolved. The problem with coroutines in my experience is that people cease to think about which operations can yield control and you end up with screwy bugs where the world changes out from under code that didn't expect it.

The new project (Adobe Carousel) is heavily asynchronous but we've been working with a Flapjax-inspired reactive programming model to deal with it and that seems to be going pretty well.