Blog: GC
Guillaume Piolat
first.name at spam.org
Sun Mar 7 11:49:17 UTC 2021
On Saturday, 6 March 2021 at 01:33:00 UTC, NonNull wrote:
>
> The article admits it is incomplete. But what can follow except
> workarounds if someone needs to get past this? And most won't
> work. This is not just a roadblock. It reveals the entropy
> inside D. The core of D is fatally flawed. D is not a language
> where system garbage is taken care of, both concretely and
> abstractly. The idea that we all system-program ourselves
> around these difficulties suggests both labor and depression.
>
I have alternative guidelines:
1. For class instances where destruction order is important (they
transitively hold something that isn't only GC memory), use
deterministic destruction. Can be with destroy(), scope, but not
with a release() function.
2. If you fear those destructors to be called by the GC, avoid it
with https://p0nce.github.io/d-idioms/#GC-proof-resource-class
If you accidentally rely on the GC for destruction, it will warn
you.
That's it. It's super simple to have everything deterministic
that way.
More information about the Digitalmars-d
mailing list