Re: [RFC] Autoloader Classmap

From: Date: Tue, 16 Mar 2021 14:21:29 +0000
Subject: Re: [RFC] Autoloader Classmap
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-113564@lists.php.net to get a copy of this message
On Mon, Mar 15, 2021, at 12:41 PM, Mark Randall wrote:
> Hi Internals,
> 
> I would like to propose the addition of a new mechanism of autoloading 
> classes - a classmap that will be consulted prior to checking the 
> spl_autoload_register'd callbacks.
> 
> https://wiki.php.net/rfc/autoload_classmap
> 
> Mark Randall
> marandall@php.net

Hi Mark.  A few questions.

1) As the stated reason for this RFC is performance, have you any benchmarks to show how much
we'd win by using an engine-space lookup rather than user-space lookup?

2) "Setting the classmap can be performed once per request."  That's not consistent
with the way the autoload functions are implemented.  I know some frameworks do funky dynamic
registration on the Composer autoloader to handle plugin code.  Allowing them to do the same with a
classmap seems beneficial, to the extent that an internal class map is beneficial.  Even if it
cannot be added to per se, "fetch, modify, and overwrite" seems like a necessary feature,
especially if there is a function to retrieve the current map.  What other purpose would that
function have?

3) The lower-casing of class names feels weird to me.  Why?  Given that most filesystems are case
sensitive, that seems like an odd requirement and the RFC doesn't include an explanation of why
that's beneficial.

--Larry Garfield


Thread (26 messages)

« previous php.internals (#113564) next »