A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/neovim/neovim/issues/19624 below:

structured concurrency, Promises, task pipelines · Issue #19624 · neovim/neovim · GitHub

related: #11312

Problem

There's no builtin abstraction for:

Expected behavior Implementations Related notes from reddit discussion

Briefly speaking, without cancellability, a structured concurrency API can and should be based on fire-and-forget coroutine functions (fafcf). Anything else would likely either be reinventing the wheel or running into a non-composable mess that is currently Plenary’s async.

With pure fafcfs, you can have most of your requirements: ability to chain, start concurrent computations, wait for completion of arbitrary “fafcfs.” It’d be quite a expressive and elegant system.

As you notice, what’s missing is cancellability. That would require creating a special protocol that fafcfs need to conform to.

After briefly looking at async.nvim, it looks like it’s trying to build concurrency by stepping through chunks, which is kind of what Plenary’s async is trying to do.

Ideally, I’d like to try to achieve cancellability without resorting to reimplementing an event loop and a scheduler in Lua. Perhaps fafcfs with a special protocol for indicating that it shouldn’t proceed would be enough.

I believe that Neovim/Lua can take design hints from Python. In this regard, Lua fafcfs are Python coroutines. They can be nested freely. If you want to a cancellable computation, you need to use Tasks, which builds upon coroutines to provide a richer interface.

kqvanity, hernancerm, kadimisetty and Fresteinakinsho, kuator, williamboman, SidOfc, rewhile and 20 morelucastrvsn, lynndylanhurley, kuator, savq, weilbith and 6 more


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4