An important pull request: accessing shared affix for immutable data

ZombineDev via Digitalmars-d digitalmars-d at puremagic.com
Sat Feb 13 13:53:22 PST 2016


On Saturday, 13 February 2016 at 21:49:48 UTC, ZombineDev wrote:
> On Saturday, 13 February 2016 at 02:35:43 UTC, Andrei 
> Alexandrescu wrote:
>> On 02/12/2016 09:21 PM, Timon Gehr wrote:
>>> Const could also mean mutable. This can hence reference the 
>>> same data as
>>> both shared and unshared, which violates the type system.
>>
>> If const comes from mutable, then shared is superfluous 
>> leading to extra synchronization. That's suboptimal, but how 
>> does it violate the type system? -- Andrei
>
> It violates the expectations that if an object is not shared, 
> it could not possibly be modified from another thread.

All threads must agree on a protocol in order for synchronization 
to work correctly.
Say thread A has a non-shared ref to an object and thread B has a 
shared ref to it. What good is this shared qualifier for B when A 
doesn't honor it?


More information about the Digitalmars-d mailing list