[dmd-concurrency] shared arrays, real, shared classes, synchronized classes

Robert Jacques sandford at jhu.edu
Fri Jan 29 16:03:21 PST 2010


On Fri, 29 Jan 2010 18:56:27 -0500, Andrei Alexandrescu  
<andrei at erdani.com> wrote:

> Robert Jacques wrote:
>> On Fri, 29 Jan 2010 18:03:15 -0500, Andrei Alexandrescu  
>> <andrei at erdani.com> wrote:
>>> 6. When defining an object of a synchronized of shared type, you still  
>>> need to qualify it with "shared" in order to make it so. For example:
>>>
>>> synchronized class A { ... }
>>> shared A a; // fine
>>> A b;        // error
>>>
>>> (I'm not 100% sure about this.)
>>  While I like the auto-documentation portion of this, this is  
>> inconsistent with scope classes. It's also redundant, particularly when  
>> we start naming classes ConcurrentQueue, etc. to differentiate them  
>> from their local cousins.
>
> It's not redundant at least in that case. The reader might see:
>
> A b;
>
> and think, cool, this is per-thread allocated.

:) And if you're naming your classes 'A' in production code I don't think  
you'll be writing production code much longer.



More information about the dmd-concurrency mailing list