What about adding a function that behaves like __autoload, but with
respect to namespace wildcards? Something like:
<?php
function __namespace_autoload($namespaceName) {
$dirHandle = opendir("/path/to/app/" . $namespaceName);
while(false !== ($file = readdir($dirHandle))) {
if(substr($file,-3) == "php") {
require_once("/path/to/app/" . $namespaceName . "/" . $file);
}
}
}
?>
That would allow for Stan's "use foo\bar\*" without impacting the
performance of normal __autoload() calls.
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
>
>
--
--------------------------------------------------------------------
Matthew Schiros
President, InvisiHosting.com
Web Development & Anonymous Web Host
Security Through Anonymity!
e: [EMAIL PROTECTED]
c: 512-466-4146
f: 888-521-4772
aim: invisirevolution
--------------------------------------------------------------------
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php