Enforced @nogc for dtors?
monarch_dodra via Digitalmars-d
digitalmars-d at puremagic.com
Mon May 5 07:08:13 PDT 2014
On Sunday, 4 May 2014 at 20:49:57 UTC, bearophile wrote:
> If we keep class destructors in D, is it a good idea to require
> them to be @nogc?
>
> This post comes after this thread in D.learn:
> http://forum.dlang.org/thread/vlnjgtdmyolgoiofnfnl@forum.dlang.org
>
> Bye,
> bearophile
Not sure that would be a good idea: "nogc" means "no interacting
with the GC". In no way does it prevent accessing a ressource
that itself is managed by the GC, which is what the original bug
was about.
Furthermore, classes *may* be deterministically desroyed, and
preventing it from interacting with the GC, if only to remove
scan pointers (think RefCounted/Array) would be needlessly
restrictive.
More information about the Digitalmars-d
mailing list