Re: [RFC] prototyping

From: Date: Thu, 22 Jan 2009 13:51:09 +0000
Subject: Re: [RFC] prototyping
References: 1 2 3 4 5 6 7 8 9  Groups: php.internals 
Request: Send a blank email to internals+get-42778@lists.php.net to get a copy of this message
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.

« previous php.internals (#42778) next »