lua-users home
lua-l archive

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


I've posted part 2 of the series:

  https://gist.github.com/belm0/abbe9acb832eafa10dcbfd2b26eb74fc

Notably, it's demonstrating error tracebacks that span multiple coroutines, and the ability to catch an error from any intermediate coroutine along the way-- just as you would with a call stack that didn't spawn coroutines.

On Fri, Sep 9, 2022 at 11:57 PM John Belmonte <john@neggie.net> wrote:
I'm sharing a draft article "Structured concurrency and Lua (part 1)".

  https://gist.github.com/belm0/4c6d11f47ccd31a231cde04616d6bb22

After the long road of lobbying for scope exit hooks in Lua (begun around the time of the Lua Gems book, in 2008), it's been nice to finally have the feature and apply it to problems.  What I couldn't imagine in 2008, however, is that one would ever want to yield from scope exit.  But Lua can do that now too, enabling interesting possibilities, such as the structured concurrency presented in the article.

Feedback is welcome here or on github.  (Encouragement also, if you'd like to see the series continue.)

Regards,
--John