Re: Reflection API RFC

From: Date: Sun, 30 Mar 2003 02:03:08 +0000
Subject: Re: Reflection API RFC
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-491@lists.php.net to get a copy of this message
A few more ideas for it:) - If you stored token start/end then you would be able to do getSource for function/method/class.. etc.. (which can do a load file/tokenizer and return implode('',array_range(starttoken,endtoken) - and add the generic methods loadTokens(); and freeTokens(); so that memory can be managed reasonably for them.. * it may also be better to store the token of the doc comment - On some of the pear classes the comment code is larger than the PHP code, and would be quite an overhead... - just make it throw an exception if you forgot to load the tokens for it.. - there appears to be no arguments array for methods/functions - not sure if extendsClass(), would be implemented by Implements?, and theres no getExtendsArray(), to return the tree of extends - constructors: - $classdetails = new ClassType('myclass'); $classdetails = new ClassType($this); rather than $classdetails = ClassType::fromName('myclass') $classdetails = ClassType::fromInstance('myclass') - I still think it would be nice to implement some of them as variables so that print_r($classdetails); would display some cute output... btw - It would also be nice to have unloadclass - so a) the codedoc generators - could load and free classes. b) php-gtk could reload modules rather than having to restart each time to test code.. Regards Alan Andrei Zmievski wrote:
I have the first draft of PHP 5 reflection API ready. You can find it at: http://www.gravitonic.com/software/php/reflection.txt Comments and suggestions are appreciated.
-Andrei                                       http://www.gravitonic.com/
"Beware of bugs in the above code; I have only proved it correct, not tried it." -- Donald Knuth


« previous php.internals (#491) next »