On Thu Nov 3 03:06 PM, Will Fitch wrote: > Wouldn't you consider spl_autoload_register an interoperability > solution? Only your defined autoloading function would then need to > know how your file system is structured, there'd be no need for > include_path declarations and you wouldn't have to explicitly declare > paths for each class. >
The problem with spl_autoload_register() is it isn't clear what the autoloading function is supposed to do if the class if not found. So no I don't think spl_autoload_register() solves an interoperability problem. SplClassLoader somewhat does a better job by forcing a common implementation... function FrameworkA_autoload($class) { if( !isset($AmapToFile[$class]) ) throw new Exception('Class '. $class . ' not found!'); include_once($AmapToFile[$class]); } function FrameworkB_autoload($class) { require_once($BmapToFile[$class]); } function FrameworkC_autoload($class) { include_once($CmapToFile[$class]); } spl_autoload_register('FrameworkA_autoload'); spl_autoload_register('FrameworkB_autoload'); spl_autoload_register('FrameworkC_autoload'); So both 'FrameworkB_autoload', 'FrameworkC_autoload' are never called. Btw, I would hope that any 'standard' would actually that try to talk about other autoloaders and how they should behave. https://gist.github.com/221634 See comments about include() or require() -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php