Revamped concurrency API

Robert Jacques sandford at jhu.edu
Mon Oct 12 18:59:03 PDT 2009


On Mon, 12 Oct 2009 21:45:20 -0400, Michel Fortin  
<michel.fortin at michelf.com> wrote:

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

I agree. Particularly about lent. Immutable and mutable weren't considered  
complete without const, so I'm surprised that local and shared are  
considered complete without lent. You can even implement it without escape  
analysis. Strangely, from what I remember of Bartosz's posts, it was  
unique that was the sticking point, though you can implement both unique  
and owned as library types (though they do become less efficient).



More information about the Digitalmars-d mailing list