Jason Tackaberry wrote:
> So basically the only way I can see to integrate coroutines into an
> existing project is to start using them only for fairly new core
> functionality of the application -- that is, something that doesn't have
> much interaction with other areas of the application, which probably
> expect more traditional callbacks.
>
> Maybe dischi has some ideas?

You wrote most of it. This Freevo already uses the kaa mainloop as base,
it is easy to make new parts use coroutines and keep the old stuff with
callbacks. E.g. I'm writing kaa.webmetadata right now (see WIP) with
tvdb and themoviedb modules. It uses coroutines but the interface is
simple. Example:

kaa.webmetadata.themoviedb.search('something') returns a coroutine. It
uses threads and other stuff internally, but the caller does not care. A
coroutine is a signal (note: a coroutine is a signal and a signal can be
handled as a coroutine. it works both ways). So yiu can call:

async = kaa.webmetadata.themoviedb.search('something')
async.connect(callback)
async.exception.connect(exception_handler)

You find stuff like this all over kaa and freevo2. There is some code
pre-coroutines that look a bit more complicated than newer functions.


Dischi

-- 
Communism is man's exploitation of man. Capitalism is just the opposite.

------------------------------------------------------------------------------
_______________________________________________
Freevo-devel mailing list
Freevo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freevo-devel

Reply via email to