On the D Blog--Symphony of Destruction: Structs, Classes, and the GC

Per Nordlöw per.nordlow at gmail.com
Fri Mar 19 11:38:23 UTC 2021


On Thursday, 18 March 2021 at 12:21:46 UTC, Mike Parker wrote:
> I actually don't agree with that. I'll be discussion the 
> solution in the next article:
>
> if(!GC.inFinalizer) {
> ...
> }
>
> It's perfectly fine to perform GC operations in destructors 
> when they aren't invoked by the GC.

Could we at least add some guard in the GC that notifies the user 
of the reason for getting an exception, preferrably including a 
source position, when trying to allocate in a destructor run 
during finalization? Not getting an explanation has stolen hours 
of my development time on several occasion. And likely happen in 
the future for other users aswell potentially making them abandon 
D for other languages.


More information about the Digitalmars-d-announce mailing list