[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Coroutines with C code that uses callbacks
- From: "Dirk Feytons" <dirk.feytons@...>
- Date: Thu, 12 Jul 2007 23:21:40 +0200
On 7/12/07, Asko Kauppi <firstname.lastname@example.org> wrote:
I'd say do a working solution, _any_ solution first. Maybe the 2nd
alternative you mentioned.
Then, I see no obvious reason why you couldn't build the coroutine
solution on top of that. But I haven't used coroutines very much,
only once.. (and even then I did not fully understand them!) :)
The problem is that we need to get the API right from the start
because it will be used in the short term. Modifying afterwards will
be difficult. Making use of the 'streaming' behavior of that C library
is really mandatory; one of the major disadvantages of our current
solution is that that one can't use it and this limits what we can do
with the library.
The API should be easy to use for developers because they typically
won't have experience with Lua. The first (ideal) pattern will
probably look more familiar to them compared with the second pattern
that potentially uses anonymous functions and closures.
I think I'll start with the second one and take it from there.
Coroutines in pure Lua is not too difficult to grasp but once you get
C code and the Lua C API involved it becomes harder to see how to fit