forcing "@nogc" on class destructors

Paolo Invernizzi via Digitalmars-d digitalmars-d at puremagic.com
Wed Jan 21 00:37:48 PST 2015


On Wednesday, 21 January 2015 at 03:02:53 UTC, Steven 
Schveighoffer wrote:
> On 1/20/15 9:04 PM, ketmar via Digitalmars-d wrote:
>> On Tue, 20 Jan 2015 20:51:34 -0500
>> Steven Schveighoffer via Digitalmars-d 
>> <digitalmars-d at puremagic.com>
>> wrote:
>>
>>>>> You can always put @nogc on the dtor if you want.
>>>> seems that you completely missing my point. (sigh)
>>>
>>> Nope, not missing it. The mechanics are there. You just have 
>>> to annotate.
>> that is where you missing it. your answer is like "hey, C has 
>> all
>> mechanics for doing OOP with virtual methods and type 
>> checking, you
>> just have to write the code!"
>
> No, actually it's not. Adding @nogc to a function is as hard as 
> writing "class" when you want to do OOP.
>
>>
>> the whole point of my talk was "free programmer from writing 
>> the
>> obvious and setup some red tapes for beginners".
>
> If he does it wrong, it gives him a stack trace on where to 
> look. What is different here than any other programming error?

Are you suggesting that newcomers should learn D by discovering 
it day by day from stack traces?

Actually there's nothing on the documentation about class 
destructors [1] that warns about that specific issue of the 
current (and default) GC.

[1] http://dlang.org/class.html#destructors



More information about the Digitalmars-d mailing list