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

Mike Parker aldacron at gmail.com
Thu Mar 4 13:54:48 UTC 2021


This post is 3+ years overdue. I initially put it off for the 
lack of a purpose-built tool in the language or the library to 
distinguish between normal destruction and finalization (when the 
GC is invoked by the destructor). After we got the 
`GC.inFinalizer` thing and having made a few stalled attempts to 
get the thing written, I finally sat down a couple of weeks ago 
and forced myself to finish it.

The result is not what I had originally intended, as the topic 
turned out to be much more involved than I had realized. What was 
supposed to be one post very quickly became two, and now it looks 
like there will be at least four before I'm done. (I didn't even 
get to the GC.inFinalizer thing in this first post.) Object 
destruction in D has dark corners that I had never knew existed 
until recently, and I expect that as I experiment with them and 
talk with some battle-hardened warriors like Adam, I'll find 
myself with many more words to write on the topic.

The blog:
https://dlang.org/blog/2021/03/04/symphony-of-destruction-structs-classes-and-the-gc-part-one/

Reddit:
https://www.reddit.com/r/programming/comments/lxkcxp/symphony_of_destruction_structs_classes_and_the/

The GC series to date:
https://dlang.org/blog/the-gc-series/




More information about the Digitalmars-d-announce mailing list