ModularM
Modular2y ago
35 replies
Heyitsmeguys

What is the basis for Mojo's `async`?

As per the title, I'm wondering what the underlying mechanism for async libraries will be. In the community meeting, it was mentioned that async and coroutines would be areas of focus in Mojo's design for the next few months, so I think this is the right time to discuss their design.

In C++, the underlying mechanism on which async libraries were built was initially chosen to be coroutines, but there's work going on right now to introduce a better alternative:

In a suite of generic async algorithms that are expected to be callable from hot code paths, the extra allocations and indirections are a deal-breaker. It is for these reasons that we consider coroutines a poor choice for a basis of all standard async.

Source

Can Mojo avoid these disadvantages or is there work to be done here?
Was this page helpful?