Should destructors be able to tell who called them?

Lutger lutger.blijdestijn at gmail.com
Tue Aug 10 12:08:30 PDT 2010


Steven Schveighoffer wrote:
...
> This would make destructors a lot more useful.  Thoughts?
> 
> -Steve

My first thought was that they are actually two separate functions distinguished 
by a boolean, then Michel also mentioned the SafeD argument. 

atm I think it is better to let go of the destructor entirely for anything else 
than the GC collecting non-gc owned data as we now have. (the unsafe version, 
not compilable in SafeD). Rather provide a standard interface to implement and 
base deterministic release of resources on that. A much more simple version of 
IDisposable. clear() can call this one and leave ~this alone. 

Anything that needs more reliability will need to use structs / reference 
counting.


More information about the Digitalmars-d mailing list