Hi! > Is this statement correct? If I understand correctly many PHP projects > depend on the deterministic firing of `__destruct()` function to cleanup > SQL transactions or connections and so forth.
Yes. But, strictly speaking, you do not have to use specifically refcounting - i.e. having some value to increment by 1 each time reference is added and decremented by 1 each time reference is removed - to achieve that. Pretty much none of the code requires there would be an actual counter - only that the system would behave as if there was a counter. Of course, in this case actually having the counter is the most natural way of doing it :) But if you find some other way of achieving the same semantics, I think it'd be still OK. > instead could unlock measurable performance improvements, and the behavior > of destructors could be closely imitated by a combination of try/finally > and other new language constructs. I am not sure I am convinced by this statement, and not sure how RAII patterns would work in GC-based environments (i.e. it seems to me they won't). That being said, many resource allocation scenarios can be implemented without RAII (in fact, C doesn't have RAII at all, people still manage to work with it :). -- Stas Malyshev smalys...@gmail.com -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php