On Friday 07 November 2008 14:47:59 Josh Thompson wrote: > 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.
"using" wildcards is considered bad practice in about any language I know, i wonder why people are so anxious to get it into PHP ... anyways, one fundamental difference is that while you can be only in one namespace, you can "use" from many. Regards, Stefan -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php