What are the real advantages that D offers in multithreading?

Brad Anderson via Digitalmars-d digitalmars-d at puremagic.com
Wed Jan 27 09:30:28 PST 2016


On Tuesday, 26 January 2016 at 20:33:34 UTC, Chris Wright wrote:
> On Tue, 26 Jan 2016 11:41:49 +0000, nbro wrote:
>> Does D
>> offer something that other known programming languages, such 
>> as C++,
>> Java and Python, do not offer?
>
> D has in the standard runtime Fibers (aka coroutines).
>
> You can use fibers in C++ if you find a library to do it (boost 
> might?). You might be able to find a Java library for it, but 
> it's difficult and might require bytecode rewriting. I think 
> pypy has coroutines. But on the whole, it's a bear to find 
> working coroutines in most languages.
>
> Go has "goroutines", which are effectively coroutines that are 
> entirely hidden from you. If you need to manage scheduling 
> yourself, or you need to ensure that a particular thing is 
> running all the time, this really isn't an option in Go.

Yeah, boost can do fibers. ASIO has clever/hacky "stackless 
coroutines" and C++17 is going to add "stackless resumable 
functions" for async/await. D is about to lose a competitive 
advantage here.


More information about the Digitalmars-d mailing list