lua-users home
lua-l archive

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


On Mon, Feb 24, 2014 at 2:33 PM, John Hind <john.hind@zen.co.uk> wrote:
>that offered by http://www.nodejs.org/ (event driven), except that scheduling coroutine >resumes would be so much more powerful than just scheduling function execution (as in >node.js) because it would maintain procedural context.

There's a fairly faithful clone of NodeJs using LuaJIT (luvit) which
is a worthwhile test bed for that kind of idea. ('Faithful' because
some key Lua things like coroutines aren't even exposed, which strikes
me as unnecessarily limiting)

Nested closures are indeed rather ugly for complex callbacks, unless
one switches notation (Coffeescript for NodeJs, Moonscript for Lua).

But yes, an elegant and general coroutine scheduler would be a fine
thing.  When considering the API, there has to be a balance between
external constraints upon coroutine execution (e.g. yield this chap
when condition) and internal logic within the coroutine itself (yield
myself when condition)

steve d.