lua-users home
lua-l archive

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

On Mon, Jan 31, 2011 at 1:45 PM, Alexander Gladysh <> wrote:
> On Mon, Jan 31, 2011 at 16:26, Peter Cawley <> wrote:
>> On Mon, Jan 31, 2011 at 1:10 PM, Steve Litt <> wrote:
>>> Speaking about what might replace it -- could something with callback
>>> functions replace it? They're powerful as all getout, but until now appeared
>>> to be the sole territory of toolmakers, with application programmers simply
>>> writing and passing small callbacks. Could that be because in other languages,
>>> callbacks are just too syntactically difficult?
>> node.js has had a lot of publicity recently, and its modus operandi is
>> to have callbacks everywhere as to avoid blocking.
> Side note: You ought to use coroutines in Lua for this.

That was my first thought too, but doing so in the naive way means
that while waiting for a I/O event to complete, you need to remember
the entire coroutine including all of its stack, which is a lot more
expensive than remembering a single closure.