Open Wes0617 opened 9 years ago
I think this would be good to have indeed. I need to reimplement most of weakref for php7 as the internals have changed (I'm not even sure weakref is possible anymore). Therefore it might be available only for php7 at first.
it's ok php7 is the future and it's happening now! :D
:+1: for php7 support and this feature, now I can remove all the hacks around this!
@colder look how I implement notify callbacks functionality in my code in php_weak_referent_object_dtor_obj()
at php_weak_reference.c:L126, the only drawback is if exception thrown in original dtor and in any of notifiers, all further notifiers will not be called.
That makes sense, but don't you have to handle the case where the callback reads the reference and stores it elsewhere?
I follow python's weakref.ref
's notify appoach where notify callback get called with a weakref.ref
object as a first arg after referent object destructed.
imagine the following: