Language proposal: abstracting over `async` (the `yields` effect)

I’ve just published a major proposal for coroutines in Mojo (i.e. async/await).

I am proposing that we replace async with a yields T syntax. This allows us to abstract over whether a function is async, and more generally, it allows us to abstract over whether traits and even entire libraries are async. This solves the function/trait/library duplication problem that arises in languages that have async/await.

This can be seen as a counter-proposal to @owenhilyard’s recent proposal on effect handlers. We are both attempting to solve the same problem, and my proposal is heavily inspired by Owen’s. The main difference between our proposals is that I have taken the raises Never trick that @clattner presented here, and adapted it to async. The end result is really exciting, in my opinion.

I am keen to hear everybody’s thoughts. :slight_smile:

If you have small comments, you can reply to this thread, but detailed feedback should probably be published on the Github thread.

3 Likes