Enforced @nogc for dtors?

Orvid King via Digitalmars-d digitalmars-d at puremagic.com
Mon May 5 07:16:49 PDT 2014


Also, the @nogc for destructors is specific to the current GC, and is
a limitation that isn't really needed were destructors implemented
properly in the current GC.

On 5/5/14, monarch_dodra via Digitalmars-d <digitalmars-d at puremagic.com> wrote:
> 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