Proposal to make "shared" (more) useful

Kagamin spam at here.lot
Fri Sep 14 09:24:52 UTC 2018


On Friday, 14 September 2018 at 08:18:25 UTC, Arafel wrote:
> shared synchronized class A
> {
>     private Unshared!S s; // Should this even be possible? What 
> about the @disable this??
> 	// I would expect at least one, if not both of the following, 
> to work
>     //private Unshared!S s2 = S(1);
>     //private Unshared!S s3 = 1;
>
>     this(){
>         s = S(1);
>         //s = 1;
>         s.f;
>     }
>     void f() {
>         writeln(s.i);
>     }
> }

You can do
     private Unshared!(S*) s;
     this(){ s = new S(1); }


More information about the Digitalmars-d mailing list