Re: Order of class resolution with namespaces and autoload
| From: | Chuck Hagenbuch | Date: | Sun, 21 Oct 2007 14:51:24 +0000 |
| Subject: | Re: Order of class resolution with namespaces and autoload | ||
| References: | 1 2 3 4 5 6 7 8 9 10 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-32903@lists.php.net to get a copy of this message | ||
Quoting Stanislav Malyshev <stas@zend.com>:
"import PHP" is a no-op now. However, I have another idea about it (besides the fix for the import thing that indeed looks like a bug to me) - what if we add some syntax to say "use this namespace" which would use autoload, so you'd say: namespace Test; throw new this::Exception(); and it would mean Test::Exception (including autoloading). Without concentrating on 'this' name (we may have another, better name for that) would it make things better?I don't think this helps; it means that you need to use the local syntax every time you use a class, instead of importing it once, and it doesn't resolve the fact that if you use a non-fully-qualified classname (like Directory, for a different example), you need to say ::Directory or else if a previous file in your namespace has defined a Directory class, the class you end up using changes. This unpredictability is I think the worst part of the current implementation. -chuck