shared - i need it to be useful

Walter Bright newshound2 at digitalmars.com
Sat Oct 20 09:04:17 UTC 2018


On 10/19/2018 11:18 PM, Manu wrote:
> The reason I ask is because, by my definition, if you have:
> int* a;
> shared(int)* b = a;
> 
> While you have 2 numbers that address the same data, it is not actually aliased 
> because only `a` can access it.

They are aliased, by code that believes it is unshared, and code that believes 
it is shared. This is not going to work.


> Exclusively distinguishing shared and unshared data is not an interesting 
> distinction if shared data has no access.

Somehow, you still have to find a way to give the shared path access, through a 
gate or a cast or a lock or whatever. And then it breaks, because two different 
threads are accessing the same data each thinking that data is not shared.


More information about the Digitalmars-d mailing list