On Friday, 7 March 2014 at 18:56:05 UTC, Andrei Alexandrescu
wrote:
On 3/7/14, 12:45 AM, Bienlein wrote:
If you want to give D a boost, put Go-style CSP and green
threads into
it as well. Then D will start to fly. Otherwise it will have
to continue
competing against C++ as its sole application area where it
will always
remain a niche player, because of the market dominance of C++.
Interesting you should mention that. Walter has been mulling
over a possible DIP on that.
Would be awesome if D got some kind of CSP. I used to reproduce
deadlocks and race conditions for some years in a shop floor
manufacturing system and fix them. From that experience I can say
that you really run into much less trouble whith channels as in
Go compared to using locks, sempahores, etc. You can even
gradually improve your concurrent solution as you can stick to
channels to which your threads are bound to. Without them threads
go through everything where locks don't help with the structuring
but only increase complexity.
If you realize there is some mutex missing, it can be very hard
to move it in place and only have little code in the mutex block.
Changing concurrent code based on locks is very deadlock
critical. So being defensive you put the mutex block around a lot
of code rather than refactoring it to get the mutex block small
to have little lock contention. With CSP you only have to fix the
way you deal with some channel or introduce some other channel.
CSP is truly a step ahead IMHO.
-- Bienlein