Hi Ralph,
>
> Thats not true. Autoloaders that are shipped with code should only be
> responsible for loading the code they are responsible for (in the least).
Ok, I can agree with that. But thats were overheads can occur
depending on the implementation of the rest of the spl registered
handlers.
As example, suppose the StandardAutoloader has a registered namespace.
And when the StandardAutoload::autoload function is called and it
determines that the class name is for that namespace but the class can
not be located then by returning false, the next registered spl
autoloader is called - but we just determined that the autoloader
shipped for that namespace could not find the class - so whats the
point in asking any of the other autoloaders?
For example, we want to find the Url view helper, heres our registered
helper namespaces/prefixes.
$prefixes = array(
'Default_View_Helper_',
'\Application\View\Helper\',
'Zend_View_Helper_'
);
foreach($prefixes as $p) {
$class = $p . 'Url';
if (class_exists($p . 'Url')) {
return $this->helper['Url'] = new $class();
}
}
If there are two spl registered handlers, ClassMap (which knows all of
the classes in the application) and the StandardAutoloader (and in ZF2
lets say it is fallback enabled). Then if 'Default_View_Helper_Url'
does not exist in the ClassMap Autoloader why should the fallback
strategy of the StandardAutoloader even be executed - it would be a
waste of time and i/o (which for ZF1 is not possible to prevent, if I
can recall, unless there is only one registered spl autoloader).
Its fine, I can work with what is there.
Regards,
--
Greg
--
List: [email protected]
Info: http://framework.zend.com/archives
Unsubscribe: [email protected]