[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: python's twisted deferred : how to in Lua?
- From: Brian Maher <maherb@...>
- Date: Tue, 23 Mar 2010 06:44:03 -0700
Another event loop library is libev. I've got a lua binding for it here:
On Mon, Mar 22, 2010 at 1:13 PM, Sam Roberts <firstname.lastname@example.org> wrote:
> On Mon, Mar 22, 2010 at 1:06 PM, Valerio Schiavoni
> <email@example.com> wrote:
>> the twisted python framework provides a very elegant mechanism to do
>> asynchronous programming, through so called 'deferred'.
>> See doc here: http://twistedmatrix.com/documents/current/core/howto/defer.html
>> I was wondering if there's support for this programming style in the
>> language itself (looking at the doc I don't think so), or if
>> something similar is provided by Lua frameworks.
> Lua doesn't need language support for this, any more than python does.
> A deferred is just an object returned to a caller that has an internal
> list of callbacks. The caller adds callback functions to it, and the
> callee, at some future time, causes the callbacks to be triggered with
> a value. twisted's deferred has some complex but useful chaining
> behaviours associated with callbacks that could be implemented, but
> its not much code not matter how you slice it.
> But deferreds aren't useful without event loop integration, so that's
> what you really want, the event framework.
> And that I don't know much about in lua, sorry. Copas is coroutine
> based, but you could use it, there are also various bindings to
> libevent and/or /dev/epoll you might be able to use, depending on your
> platform. you'll find them if you google.
Brian Maher >> Glory to God <<