Re: SPLClassLoader RFC Thoughts And Improvements
| From: | David Muir | Date: | Thu, 10 Nov 2011 23:13:10 +0000 |
| Subject: | Re: SPLClassLoader RFC Thoughts And Improvements | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-56262@lists.php.net to get a copy of this message | ||
Surprised to say that I agree on just about everything you mentioned. I
would however love to see a useful autoloader included in core. I have
only one comment below.
> 4. The RFC should avoid implementing any pattern or style that may
> make future feature addition difficult or pose risks towards such. An
> example would be implementing an interface for the autoloader which
> defines something like load($class). The problem there is that if
> function autoloading is added, the interface won't be able to support
> it. So it's stuck in a hard place between changing an implemented
> interface (which will bork code significantly on update) and adding a
> new interface (which would be the lesser of evils, but would just add
> to the deprecated cruft).
IMO, the interface should just define loadClass($class). It means that
spl_autoload_register has a fixed target for loading classes, and if we
want to support autoloading functions or whatever else later on, a new
interface can be added that would define the appropriate method eg.
loadFunction($function).
Cheers,
David