Revamped concurrency API

Michel Fortin michel.fortin at michelf.com
Mon Oct 12 18:45:20 PDT 2009


On 2009-10-12 11:45:55 -0400, Andrei Alexandrescu 
<SeeWebsiteForEmail at erdani.org> said:

> Occasionally people here ask for ways in which they can help D. One 
> thing that would be extremely helpful at this point would be to help 
> defining and implementing D's new concurrency API. Unfortunately, 
> Bartosz has declined to contribute. That leaves Walter, Sean, Don, and 
> participants to this group to do it.

So Bartosz quit? Not that much surprising given the all too many 
missing building blocks.

I recently realized that you can easily implement unique in a library. 
It can work pretty much the same as auto_ptr in C++. But to guaranty 
uniqueness you need either to rely on convention (as in C++), or add 
support for lent to the compiler.

I know we discussed at length how lent could be implemented, we called 
it 'scope' and 'escape analysis' at the time and the conclusion you 
(and Walter I guess) came with was that it was too much for D2.

Well, without lent (and thus without unique), safe message passing 
systems across threads will be limited to immutable data, or copied 
data, which not at all useful in many situations.

Now if you want a good concurrency API relying on convention, then 
that's great: there are plenty of examples to follow out there. But if 
you want it to be both safe (enforced) and useful at the same time, 
that's a mission impossible with the current set of tools available 
from the compiler.

That's why I'm not surprised Bartosz declined to implement it.

(And sorry if I sound pessimistic.)


-- 
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/




More information about the Digitalmars-d mailing list