On Tuesday, November 12, 2013 23:40:24 Florian wrote: > it would be possible to move the shutdown() sequence into the > destructor of the "Connection" class.
Classes in D do not have destructors. Only structs to. ~this is a destructor in a struct, but it's a finalizer in a class. Finalizers are not guaranteed to be run, and they can't do anything with GC memory (be it allocating it, deallocating it, or using it) unless they're begging for trouble, because the GC is free to collect any GC-allocated objects before calling any finalizers (which avoids circular reference problems). As such, class finalizers are really only good for managing non-GC resources. - Jonathan M Davis