shared - i need it to be useful

Stanislav Blinov stanislav.blinov at gmail.com
Sat Oct 20 16:41:41 UTC 2018


On Saturday, 20 October 2018 at 16:18:53 UTC, aliak wrote:

> class C {
>   void f();
>   void g() shared;
> }
>
> void t1(shared C c) {
>   c.g; // ok
>   c.f; // error
> }
>
> void t2(shared C c) {
>   c.g; // ok
>   c.f; // error
> }
>
> auto c = new C();
> spawn(&t1, c);
> spawn(&t2, c);
> c.f; // ok
> c.g; // ok

Those are not "ok". They're only "ok" under Manu's proposal so 
long as the author of C promises (via documentation) that that's 
indeed "ok". There can be no statically-enforced guarantees that 
those calls are "ok", or that issuing them in that order is "ok". 
Yet Manu keeps insisting that somehow there is.


More information about the Digitalmars-d mailing list