More radical ideas about gc and reference counting

H. S. Teoh via Digitalmars-d digitalmars-d at puremagic.com
Thu May 1 15:02:34 PDT 2014


On Thu, May 01, 2014 at 02:19:17PM -0700, Walter Bright via Digitalmars-d wrote:
> On 5/1/2014 7:01 AM, H. S. Teoh via Digitalmars-d wrote:
> >The proposal was to get rid of class dtors, in which case this code will
> >no longer work. Is that really the direction we want to move in?
> 
> My point was that the compiler wasn't ignoring destructors for fields.
> 
> Who should call the class destructor and when is a different issue.

I'm confused. Andrei's original proposal was to deprecate class dtors,
with the view to eventually getting rid of them altogether. If indeed
that's going to be the case, then wouldn't that mean that field dtors
won't be invoked either (because otherwise, how would you know when to
invoke a field dtor?)?

Without a clear definition of who is going to clean up those fields and
invoke their dtors, it would seem to me that having fields with dtors in
a class (once class dtors no longer exist, according to Andrei's
proposal) will be a dangerous thing to do, since the very guarantee by
having a dtor in the first place (it will get called to clean up when
the struct goes out of scope) is broken. If so, what's the point of
having a dtor in the first place? It becomes no different from the
manual cleanup that you have to do in C.


T

-- 
Verbing weirds language. -- Calvin (& Hobbes)


More information about the Digitalmars-d mailing list