[feature request] Special method to be called on class instance to ask (and wark object) before garbage collection

AnimusPEXUS animuspexus at protonmail.com
Mon Aug 1 05:33:02 UTC 2022


how should it work?:

when GC finds class instance which is good to be collected, it 
calls special function on this instance: `bool 
good_to_collect()`. if function returns true, then on next pass 
GC cleanups object without calling to `good_to_collect()`. if 
function returns false, then GC does nothing with object and 
continues periodically asking object if it's ready to be 
collected.

`good_to_collect()` it self can be used by App, to perform 
cleanups, for instance destroy dependent objects.




More information about the Digitalmars-d mailing list