On 3/5/21 8:29 PM, Jack wrote: > Now about the behavior of a static destructor, like static ~this() { } > is this guaranteed to be run?
I don't know any way of creating a module on the GC heap so their destruction should not be related to GC collection. I would expect all 'static ~this()' blocks to be executed upon thread termination.
'shared static ~this()' blocks are said to be executed after main() exits in the following page but that description is not precise enough because 'shared static ~this()' blocks of a dynamic library would be executed when the library is unloaded.
https://dlang.org/spec/class.html#SharedStaticConstructor Ali