About whether D / rust / golang can be popular.

Ola Fosheim Grostad ola.fosheim.grostad at gmail.com
Thu Nov 26 14:55:48 UTC 2020


On Thursday, 26 November 2020 at 14:18:55 UTC, Jacob Carlborg 
wrote:
> On Thursday, 26 November 2020 at 09:49:51 UTC, Ola Fosheim 
> Grostad wrote:
>
>> Isnt await just syntactic sugar for a promise/future?
>
> No, not really, but it's used together with promises or they're 
> used under the hood.
>
>> If you can provide an example of what await should expand into 
>> then I might be able to add it to my experimental D compiler 
>> and you could then write a DIP.
>
> Async/await is basically a coroutine. It allows a function to 
> be suspended and resumed. Here's an example of how the code 
> could look like in D:

Ok, we need something that respects shared/nonshared. If 
aync/await involves multiple threads then we need something 
principled.

Maybe some runtime level thing that can offload computations but 
is as easy to use as await. Perhaps even offload to the GPU.

But I guess people want it for I/O.

Clearly a case where a library solution has to come first.

> When a function is suspended, all its state (stack and 
> registers) need to be saved. When it's later resumed, the state 
> need to be restored.

This should be possible with LLVM stop points.



More information about the Digitalmars-d mailing list