Some missing things in the current threading implementation

Sönke Ludwig ludwig at informatik.uni-luebeck.de
Tue Sep 14 23:13:57 PDT 2010


Am 12.09.2010 17:54, schrieb Robert Jacques:
> On Sun, 12 Sep 2010 09:35:42 -0400, Sönke Ludwig
> <ludwig at informatik.uni-luebeck.de> wrote:
>> 9. unique
>>
>> Unique objects or chunks of data are really important not only to be
>> able to check that a cast to 'immutable' is correct, but also to allow
>> for passing objects to another thread for computations without making
>> a superfluous copy or doing superfluous computation.
>
> Unique (or for those with an Occam background 'mobile') has several
> proponents in the D community (myself included). It was seriously
> considered for inclusion in the type system, but Walter found several
> issues with it on a practical level. If I recall correctly, Walter's
> exact issues weren't made public, but probably stem from the fact that
> unique/mobile types in other languages are generally library defined and
> are 'shallow'. They exist as a 'please use responsibly' / 'here be
> dragons' feature. For unique to be safe, it needs to be transitive, but
> this severely limits the objects that can be represented. For example, a
> doubly-linked-list can not be unique. Unique has been integrated into
> the Clean and Mercury functional languages (or so says Wikipedia), so
> there might be reasonable solutions to these problems.

Unique indeed seems to be a complicated problem when you want to make it 
flexible for the case of nested objects. However, I think it might 
already be very useful, even if it works well only with POD types and 
arrays. It would be interesting to collect different use cases and see 
what is really needed here so that an overall solution can be created later.


More information about the Digitalmars-d mailing list