This is an automated archive made by the Lemmit Bot.

The original was posted on /r/neovim by /u/Foo-Baa on 2024-11-10 12:05:30+00:00.


Hi,

Motivated by responses to my recent post on how to use coroutines in Lua, I wrote a plugin for structured concurrency in Lua: Coop.nvim.

Here’s why you may find it interesting:

  • Coop provides all the goodies you would expect from a cooperative scheduling framework: cancellation, error-handling, complex control structures.
  • I think Coop uses an elegant design that I couldn’t find in anything else. I’ve written down how it works, so even if you don’t use Coop, you may find it illuminating for how Lua coroutines work and how you can extend them without going crazy with complexity.

Most Libuv functions are already ported to Coop but not all. Same for control combinators. I wanted to see if there’s any uptake or significant comments before finishing the tail end of features.