Re: AW: [PHP-DEV] Namespace resolution
| From: | David Zülke | Date: | Tue, 11 Dec 2007 23:58:58 +0000 |
| Subject: | Re: AW: [PHP-DEV] Namespace resolution | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-33948@lists.php.net to get a copy of this message | ||
Am 12.12.2007 um 00:24 schrieb Stanislav Malyshev:
I was assuming there was no need to explain that "// the real deal" is where the class loading goes. Look. If you have an autoloader for Your::Namespace, then you just need to check if the class name (which is fully qualified, with the entire namespace prefix in the name) starts with "Your::Namespace" to prevent disk access. Davidnamespace Name::Space; class Ship { public static function __autoload($className) { if(strpos($className, 'Name::Space::') === 0) {I don't understand. Is your autoloader going to do any disk accesses at all or it's just a stub that doesn't load any classes? If it does disk access, it would do it on any internal class access inside namespace Name::Space. Please explain me in detail how it could ever happen otherwise.// the real deal }} } ... spl_autoload_register(array('Name::Space::Ship', '__autoload')); No disk access. And with my suggestion to allow limiting autoloaders to