Re: Generic decorators and type hinting

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx




[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux