[PHP-DEV] [RFC] Function Autoloading (mark 5)

Hi

On 2026-07-15 20:35, Paul M. Jones wrote:

The RFC has been updated to un-incorporate the strict-namespace elements; if there are no further substantive comments, I would like to open the vote in 2-ish weeks.

To put my remark in the (canceled) voting thread into the correct place, quoting myself from php.internals: Re: [RFC] [VOTE] Function Autoloading (mark 5)

Without giving it detailed thought, I believe “Namespaced function, Autoload namespaced function, Global fallback” (i.e. swap steps 2 and 3) would result in much more predictable semantics already - the global fallback would work just as before, it just wouldn't have autoloading support. It's quite possible I'm changing my mind on that as well when I think more about it […]

Best regards
Tim Düsterhus

Hi Tim,

I posted this in the other thread, but I'm not sure it got through, so I'll repost here; apologies if both show up at once.

On 31 July 2026 18:12:01 BST, "Tim Düsterhus" <tim@bastelstu.be> wrote:

Without giving it detailed thought, I believe “Namespaced function, Autoload namespaced function, Global fallback” (i.e. swap steps 2 and 3) would result in much more predictable semantics already - the global fallback would work just as before, it just wouldn't have autoloading support.

Semantically, that makes most sense, but it leads to terrible performance for the global fallback case, unless there's some way to avoid multiple checks for the same namespaced function. That's why we keep going round in circles on the whole issue.

I think Michael's "namespace autoloader" idea is a much cleaner way forward - it avoids the fallback issue without creating lots of extra special cases, and in reality "load a file with all functions for namespace Foo\Bar" is likely to be more common than "load a file which specifically defines function Foo\Bar\baz()".

Regards,

Rowan Tommins
[IMSoP]