On 5/17/18 9:09 AM, Joe Watkins wrote:
Morning internals,
I'd like to raise for discussion https://wiki.php.net/rfc/weakrefs
Am I missing anything ?
Cheers
Joe
Hi,
Would we benefit having notification mechanism in weak references? I
implemented such notification in https://github.com/pinepain/php-ref,
(used https://github.com/colder/php-weakref as a reference). The only
issue is that how notification logic should behave when unclean shutdown
happens, the culprit is some exception thrown which leads to referent
object destruction and this uncertainty doubles when notification logic
(callback) also triggers exception. So I bring this question more for
discussion and it could be definitely implemented later (small working
feature is better then large non-working one).
Seen that there is weak data structs discussion below, there is
https://github.com/pinepain/php-object-maps weak/soft map implementatoin
I made at the time of php-ref extension. It somehow based on java maps
interface and I think with notification interface for weak refs it's
fairly simple to implement such maps in userland THOUGH without
notification, having primitive weakmap in the psl needs to be taken with
care to do not end up like other psl data structs.
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php