My personal favorite use of Reflection is Class Factories. While this could be done with:
<?php $className = 'Util'; $obj = new $className(); ?> It seems a little blunt to me, it also doesn't support having a variable number of arguments to the constructor. I've seen some pretty egregious hacks to make the above code work with a variable number of arguments. I typically go for: <?php $ref = new ReflectionClass($className); $obj = $ref->newInstanceArgs($args); ?> It also seems like we have two different methods for accessing this sort of information. Functions that are single purpose like get_class_* and the Reflection interface. Saying that we have this nice clean interface through reflection, but shouldn't use it because no one wants to optimize it seems like a pretty thin argument. On Wed, Jan 21, 2009 at 9:20 AM, Christian Schneider <cschn...@cschneid.com> wrote: > Nathan Rixham wrote: >> seems to me that many of the new requests coming in, including my own >> stupid ones are because people want to build fast decent orm's in php - > > Having built an ORM system myself I can say that you don't need > Reflection (or even other fancy features not yet in PHP) for this. > > Maybe you are trying to use a hammer when the problem is not a nail, > - Chris > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > -- -Nathan Gordon If the database server goes down and there is no code to hear it, does it really go down? <esc>:wq<CR> -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php