"Matīss Roberts Treinis" <mrtrei...@gmail.com> wrote:

>Proposal:
>
>Two additional magic methods for PHP objects -
>
>__refer(void):
>
>Refer method is called whenever object's identifier is assigned to
>variable, if such method is present.
>Example:
>
>$foo = new Bar;
>$bar = $foo; //__refer invoked

This assignment is handled using PHP's copy on write mechanism for any 
variable. A change here has massive impact on any variable assignment, function 
parameter passing, ... and tons of internal places.

What we have is a hook for the objects own reference counting which is affected 
when an object refering to an object is used in write-context by the engine, 
that might easily be exteded but is rather useless. (It's trivial to create an 
interface or abstract base class providing this addref/delref info)

Unless you can provide a robust good patch without performance penalty in cases 
where this isn't used this will lead nowhere, and I doubt there is a way to 
come up with that. (rewriting the engine might be the closest approach)

johannes


-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to