On 09/08/2016 17:05, Rasmus Schultz wrote:
I'm suggesting the use-statement be the trigger, rather than actually
calling the function.
In other words, calls to substr() does not trigger the resolve - a
statement like "use function substr" on the other hand, does.
Ah, I see. The problem with that is, you still have to explicitly list
every function you're going to use, so you might as well just use
require_once, or call "load_function('substr')" directly.
I think, in practice, it's not going to work much differently from the
other proposed work-around though - if only qualified references
trigger auto-loading, then this would trigger auto-loading:
\foo\bar();
And this would too:
use foo\bar;
bar();
But this would not:
bar();
Yep, that's about the size of it. If I could go back and time and join
the discussion at the time of PHP 6 / PHP 5.3, I'd argue for simplifying
the name resolution, so the last one was either always the current
namespace or always a global name. Pass me that faster-than-light
telephone... ;)
Regards,
--
Rowan Collins
[IMSoP]
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php