lua-users home
lua-l archive

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

Thanks, Richard.

Whether someone would choose Lua or Stackless Python for coroutines is
probably a matter of preference for the language itself.  But one
thing Stackless might provide that Lua does not, is the ability to
block C function calls as well as Python function calls given that we
shift C stack sections in and out with tasklets.  Or the ability to
persist and unpersist in a cross platform way, running tasklets.


I just noticed that there is 'Coco' for lua, which seems to provide similar C stack manipulation to that used in Stackless:

Coco is a small extension to get True C Coroutine semantics for Lua 5.1.

True C coroutine semantics mean you can yield from a coroutine across a C call boundary and resume back to it.

Coco allows you to use a dedicated C stack for each coroutine. Resuming a coroutine and yielding from a coroutine automatically switches C stacks, too.

In particular you can now:

Best of all, you don't need to change your Lua or C sources and still get the benefits. It's fully integrated into the Lua core, but tries to minimize the required changes.


So far I do not see a lua answer to Stackless's pickling support. (Live, running 'tasklets' in Stackless can be serialized and then resumed - anywhere that you can run Stackless...)