[Stackless] lua vs. stackless python

Phoenix Sol phoenix at burninglabs.com
Fri Apr 24 15:52:31 CEST 2009

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.
> Cheers,
> Richard.

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,

In particular you can now:

   - Yield across all metamethods (not advised for __gc).
   - Yield across iterator functions (for x in func do).
   - Yield across callbacks (table.foreach(), dofile(), ...).
   - Yield across protected callbacks (pcall(), xpcall(), ...).
   - Yield from C functions and resume back to them.

 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...)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.stackless.com/pipermail/stackless/attachments/20090424/59ed3161/attachment.htm>

More information about the Stackless mailing list