Opportunities for D

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Wed Jul 9 22:58:39 PDT 2014


On 7/9/14, 8:59 PM, logicchains wrote:
> On Thursday, 10 July 2014 at 02:12:18 UTC, Atila Neves wrote:
>> Rob Pike has said multiple times that the key/unique thing about Go is
>> "select" and that goroutines are the easy part. I'm not entirely sure
>> I grok what he means but we should if we're going to try and do what
>> they got right.
>
> Select is vital for Go in the sense that without it there'd be no way to
> do non-blocking send/receives on channels in Go. It's much more concise
> than the alternative, which would be something like `if chanA is empty
> then foo(chanA) else if chanB is empty then bar(chanB)`. It also avoids
> starvation by checking the channels in a random order - unlike the
> previous if-else chain, which would never call bar(chanB) if chanA was
> always empty.

That's what I think as well.

> It's been implemented in Rust[1] via a macro, and can be implemented in
> Haskell[2] without compiler support, so I'd be surprised if it wasn't
> already possible to implement in D. It wouldn't however be as useful as
> Go's until D gets message passing between fibres.

Yah.

> Actually, an important question that should be considered: does D want
> actor-style concurrency, like Erlang and Akka, or CSP-style concurrency,
> like Rust, Go and Haskell? Or both? Deciding this would allow efforts to
> be more focused.

We already have actor-style via std.concurrency. We also have fork-join 
parallelism via std.parallel. What we need is a library for CSP.


Andrei




More information about the Digitalmars-d mailing list