Re: Generic decorators and type hinting
| From: | David Kurtz | Date: | Wed, 02 Sep 2009 19:25:23 +0000 |
| Subject: | Re: Generic decorators and type hinting | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-297610@lists.php.net to get a copy of this message | ||
On Sep 2, 2009, at 12:17 PM, Ben Dunlap wrote:
I've got some sample code written that first calls get_class_methods() to list the names of all the visible methods of the parent object, then constructs code to declare a child class that overrides those methods with wrapper methods, and finally eval()s the declaration and instantiates an object of the new class.You're right; that is evil. But, interesting idea. It turns out for my specific purposes (a generic decorator that measures a class's method execution times), a full-fledged profiler like APD is really what I need, but I'll keep this in mind for getting around the type-hinting, should the need arise again. Thanks. -- David Kurtz dkurtz@technorati.com