Proposal: GC and "delete"
Unknown W. Brackets
unknown at simplemachines.org
Sun Apr 6 11:08:11 PDT 2008
IMHO, the simple solution to this is an "opDelete" which gets called
when and only when "delete x;" is used (afterward delete would be called
as standard.)
-[Unknown]
Brian White wrote:
>> The only time you would have user code running while the GC is running
>> is in a destructor, and you shouldn't be accessing heap objects that
>> potentially need to be deleted from the destructor anyway, since the
>> order of destruction is unpredictable.
>
> Which was exactly the problem I was trying to address. Sometimes (like
> with RAII), you want an object destructed when it goes out of scope and
> if that object contains other RAII objects, they must be
> deleted/destructed, too.
>
> However, I think I've got a better idea. Give me some time to write it
> up...
>
> -- Brian
More information about the Digitalmars-d
mailing list