About whether D / rust / golang can be popular.

Jacob Carlborg doob at me.com
Thu Nov 26 18:27:25 UTC 2020


On 2020-11-26 15:55, Ola Fosheim Grostad wrote:

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

That varies between implementations. You can either do single threading. 
Or have multiple threads (as many as the computer has cores) with one 
event loop per thread. Each async function can only be executed on a 
single thread. Or multiple threads with a single event loop and the 
async functions can run on multiple threads. That is, run on one thread, 
be suspended and be resumed on another thread.

For example, Erlang was initially only single threaded. In 2006 it 
started to take advantage of multi-core.

Go will automatically create a new thread if calling a C function or a 
blocking system call.

> 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.

Yes, that's the main reason. If you don't have anything to wait for, 
there's not much point in suspending a function.

> This should be possible with LLVM stop points.

Yes. C++20 got support for coroutines, which also means support in LLVM.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list