Re: [RFC] New core autoloading mechanism with support for function autoloading
| From: | Anton Smirnov | Date: | Mon, 10 Apr 2023 19:12:31 +0000 |
| Subject: | Re: [RFC] New core autoloading mechanism with support for function autoloading | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-119874@lists.php.net to get a copy of this message | ||
Hello George,
I'm not sure I'm 100% correct but I think that this RFC still allows to
call different functions for the same code, just not in the same run.
Consider this pseudocode:
//- funcs.php
namespace My;
function myfunc(...) { ... }
function array_map(...) { ... }
//- code1.php
namespace My;
myfunc(1); // autoload triggered
// bonus points if it's a different file or some obscure method
array_map(strlen(...), []); // My\array_map
//- code2.php
namespace My;
// no prior autoload
array_map(strlen(...), []); // global array_map
And if I understand the current order of execution correctly, here is a
more extreme example:
//- moreextreme.php
namespace My;
if (some_random()) {
array_map('My\myfunc', []); // global array_map
} else {
array_map(myfunc(...), []); // My\array_map
}
--
Anton