forcing "@nogc" on class destructors

deadalnix via Digitalmars-d digitalmars-d at puremagic.com
Tue Jan 20 14:03:54 PST 2015


On Tuesday, 20 January 2015 at 20:51:18 UTC, Steven Schveighoffer 
wrote:
> On 1/20/15 3:39 PM, ketmar via Digitalmars-d wrote:
>
>> and all that mess can be avoided just by enforcing the one 
>> simple rule,
>> which compiler is perfectly able to check.
>
> I think the current situation is fine.
>
> 1. There are functions that sometimes allocate. I don't want to 
> forbid those, or force someone to write @nogc versions.
> 2. One can invoke destructors without being inside the GC.
>
> This seems like a good job for a lint tool.
>
> -Steve

+1

If you want to fix something, fix the possibility to escape
the this reference. The @nogc thing is simply an limitation of 
the implementation of the GC.


More information about the Digitalmars-d mailing list