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

Per Nordlöw per.nordlow at gmail.com
Thu Mar 18 08:15:01 UTC 2021


On Thursday, 4 March 2021 at 13:54:48 UTC, Mike Parker wrote:
The blog:
> https://dlang.org/blog/2021/03/04/symphony-of-destruction-structs-classes-and-the-gc-part-one/

Reminds me of longing for an (optional) compiler warning or, even 
better, a deprecation when

- destructors of GC-managed objects that perform any operation 
that can potentially result in a GC allocation request and /or
- allocating structs on the GC heap that have destructors

.

In the mean time a good rule of thumb is to qualify all class 
destructors as @nogc. I suggest you add this advice to the 
article, Mike.

Thanks!


More information about the Digitalmars-d-announce mailing list