Async-await on stable Rust!

rikki cattermole rikki at
Fri Nov 8 10:36:05 UTC 2019

On 08/11/2019 10:57 PM, Sebastiaan Koppe wrote:
> On Friday, 8 November 2019 at 02:13:28 UTC, rikki cattermole wrote:
>> So from what I can tell, there are two aspects to this.
>> 1. Future's which have custom executors which you must explicitly call.
>> 2. async/await which ties into the borrow checker and requires await 
>> to be called so pretty much stack only.
>> From previous discussion this isn't what we want in D.
>> The previous designs discussed is an event loop poll based and heap 
>> allocate the closure.
>> It does mean that we need an event loop in druntime, but since I am 
>> expecting to write up an event loop soon for the graphics workgroup 
>> I'll add that to part of its requirements (with -betterC compatible).
> Please have a look at the approach taken by structured concurrency. 
> Recently mentioned on this forum by John Belmonte: 
> Kotlin has taken that route as well and I have found working with it's 
> concurrency very pleasant.
> The central idea of structured concurrency (a term taken from structured 
> programming) is to provide 'blocks' or nurseries where tasks 
> (threads/fiber/coroutines) run concurrent, and only exit those blocks 
> when all it's concurrent tasks are finished.
> It is a simple restriction, but solves a lot of problems. You can follow 
> the links provided in John Belmonte's posts for some more explanation.

This is a better article from one of the sites you linked:

After reading this, I can confidently say that this is not the problem I 
am trying to solve.

To me async/await is synchronously executed when a closure is ready to 
execute. However, that doesn't mean it can't work with my existing idea ;)

Nursery nursery;

nursery.async {

nursery.async {

return; // nursery.__dtor == run

More information about the Digitalmars-d mailing list