Hi Marcus,
I've just got an idea how prototyping may be implemented without magic
you solution had. We can use a special function
function attach_method($object, $name, $closure);
This function should clone the $closure bind $this of clone of $closure
to $object and assign it into $object->name (the original $closure
should be unchanged).
However it won't make possible to call it as $object->name() anyway.
Also, it's a question what should attach_method() do if $closure already
has $this (rebind it or throw an exception).
Thanks. Dmitry.
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php