Johannes Schlüter wrote:
On Thu, 2008-11-06 at 22:19 -0600, Josh Thompson wrote:
I don't understand why in the namespaced example no one seems to have a problem with new A() meaning new \foo\bar\A(), but we can't use the * wildcard to do the same thing?

Since we don't reliable know all possible classes, think about
_-autoloading classes, which means we'd have to do more work during
execution, which can be a slowdown.

johannes


But we don't reliably know all possible classes in the namespace example, where we can be autoloading the classes. In the wildcard example we (c/w)ould already be autoloading the classes anyway, but instead of sending the class names (A and B) we would send it the namespace class names first (foo\bar\A and foo\bar\B) and then if that failed try without the namespace. If one of the classes (B for example) is in the global namespace, then the developer can simply prefix it with a (\B) to save on one autoload call.

I still don't see the fundamental difference between the namespace and wildcard example.

--
Joshua Thompson
Mechanical Engineer/Software Developer
http://www.schmalls.com

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to