Re: Idea: Function autoloading using dummy namespaces

From: Date: Tue, 19 Jul 2016 01:58:32 +0000
Subject: Re: Idea: Function autoloading using dummy namespaces
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-94575@lists.php.net to get a copy of this message
On Mon, Jul 18, 2016 at 9:55 AM, Nikita Popov <nikita.ppv@gmail.com> wrote: > > A relaxed variant would only invoke the autoloader once for each > call, assuming that a function that is not loadable at one time will never > become loadable (which is of course a significant restriction). The former > variant would be prohibitively slow. The latter is more realistic, but I > expect it to have non-trivial performance impact nonetheless. > > Is that really a significant restriction? The only difference it would make is for code that expects "namespace Bar { foo(); }" to refer to global function "foo()" at one point in the program, and later to refer to "Bar\foo()" at another point in the program, after "Bar\foo" has become loadable. That kind of temporal coupling with the symbols that happen to be loaded/loadable at a given point in time sounds just awful, and I can't imagine what the use case would be. Considering Option B can cause the introduction of global functions to break code (my previous email), the caching of negative results from the autoloader sounds like the only feasible option.

« previous php.internals (#94575) next »