On Monday, 7 November 2016 at 02:22:35 UTC, Steven Schveighoffer wrote:
Imagine a resource wrapper like so:

class Foo
{
   int *mem;
   this() { mem = cast(int *)malloc(int.sizeof); }
   ~this() { .free(mem); }
}

Now, you have a problem if you do something like this:

class Bar
{
   Foo foo;
   ~this() { delete foo; }
}


Is there a valid use case for something like this? Why would you want to do anything inside ~this with GC memory?

Reply via email to