Re: Order of class resolution with namespaces and autoload
| From: | Chuck Hagenbuch | Date: | Tue, 23 Oct 2007 04:01:48 +0000 |
| Subject: | Re: Order of class resolution with namespaces and autoload | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-32926@lists.php.net to get a copy of this message | ||
Quoting Stanislav Malyshev <stas@zend.com>:
My last word on this is just going to be to ask you to consult with the Zend Framework team (Matthew W.), PEAR2 (Greg), and perhaps some other large PHP class libraries/frameworks. I don't think it's unreasonable to say that namespaces should be heavily influenced by the kind of large projects that will use them. I'm speaking for Horde; if all the other large projects prefer it the way it currently is, then that's fine, I can live with that, but if not, I just ask that you reconsider. Thanks, -chuckYes. I think that if you use an unqualified name it should always be relative to the namespace (and importing internal classes into your namespace lets you use short names for them, avoiding ::Exception).Unfortunately, there are problems with this solution, since it makes common case harder to implement - internal classes are more frequently used than overridden. It makes harder to convert library code which does not use tricks like overriding system classes - which is on my experience most of the code - you have now to go to almost every file and find all the system classes you have used there and put imports for them.