[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Coroutine library scheduler
- From: steve donovan <steve.j.donovan@...>
- Date: Mon, 24 Feb 2014 14:57:07 +0200
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.