Hacker News new | ask | show | jobs
by pimeys 2566 days ago
It does. You just have to use an Rc/Weak Arc/Weak combination.
1 comments

Weak refs are a way to work around reference counting cycles, but cyclic garbage collection is a more complete solution and it's a core feature of nearly every high level language.

https://www.php.net/manual/en/features.gc.collecting-cycles....

It seems like people who often use Rust's Rc and Arc will long for some way to implement generic cyclic garbage collection. I don't yet see a way (other than unsafe code), but I may be missing something.