lua-users home
lua-l archive

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



> -----Original Message-----
> From: lua-bounces@bazar2.conectiva.com.br [mailto:lua-
> bounces@bazar2.conectiva.com.br] On Behalf Of Mike Pall
> Sent: Tuesday, February 15, 2005 11:44 AM
> To: Lua list
> Subject: Re: PATCH: Fully Resumable VM (yield
> acrosspcall/callback/meta/iter)
> 
Hi Mike,

> 
> But the Lua API issue remains: coroutine.eresume() feels so un-orthogonal.
> 
> And error([co,] err) just doesn't cut it. The coroutine may continue
> running when pcall has caught the error! This is more like a resume,
> not like a non-local throw.
> 
> Does any other language have such a concept? I know that everyone is
> working around this issue with native threads, since you cannot reliably
> kill them. Lots of 'if (flag) { dealloc(); pthread_exit(); }' littered all
> over the source. Not pretty -- I really want to avoid this.

I vaguely recall reading about Erlang avoiding such a situation by including
messaging natively into the language - but my interpretation of what I read
may be totally wrong.

In the context of coroutines, I found an interesting read that others (on
the Lua list) may find useful as well:

[1] http://www.chiark.greenend.org.uk/~sgtatham/coroutines.html

At the end of the article the author alludes to having a context to make the
proposed scheme more robust; I thought that with the Lua State providing
such a context, there may be some interesting paths that can be explored -
someday when I have time...

BTW, great job on the patch and the documentation - Kudos to you. And if
there were ever a vote, count me in to vote in favor of making coroutines
first class objects and to make it available as part of the standard
distribution.

Cheers
Vijay Aswadhati