GC Destruction Order

bitwise via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue May 19 20:44:57 PDT 2015


On Tue, 19 May 2015 19:16:14 -0400, Adam D. Ruppe  
<destructionator at gmail.com> wrote:

> On Tuesday, 19 May 2015 at 23:10:21 UTC, bitwise wrote:
>> ....which is why I am asking if there are any plans to implement  
>> something like @nogc for entire modules or classes.
>
> At the top:
>
> @nogc:
> <stuff here>
>
> Gotta do it inside the class too i think.


Thanks!

this seems to work too:

@nogc {
    <stuff>
}


I think this is still a problem though:

struct StackThing { ~this() { writeln("where am I?"); } }

class HeapThing{
     StackThing thing;
}

HeapThing thing = new HeapThing();

Basically, I can't design a struct and be sure the destructor will be  
called on the same thread as where it went out of scope.

I hope I'm wrong and DIP74 comes soon =/

   Bit


More information about the Digitalmars-d-learn mailing list