shared - i need it to be useful

John Colvin john.loughran.colvin at gmail.com
Mon Oct 22 21:40:23 UTC 2018


On Monday, 15 October 2018 at 18:46:45 UTC, Manu wrote:
> Okay, so I've been thinking on this for a while... I think I 
> have a pretty good feel for how shared is meant to be.
>
> [...]

I don't understand how you can safely have simultaneously shared 
methods that can modify data and unshared references that can 
modify data.

struct S {
     int* x;
     void incX() shared { ... }
}

auto x = new int;
auto s = shared S(x);

Now I have two references to x, one shared, one unshared, both 
can be written to.

What am I missing?


More information about the Digitalmars-d mailing list