Re: function autoloading v4 RFC

From: Date: Tue, 20 Aug 2024 06:50:07 +0000
Subject: Re: function autoloading v4 RFC
References: 1 2 3 4 5  Groups: php.internals 
Request: Send a blank email to internals+get-125062@lists.php.net to get a copy of this message
On 20 August 2024 00:21:22 BST, Rob Landers <rob@bottled.codes> wrote: > >I assume you are worried about something like this passing test? > >--TEST-- >show called only once >--FILE-- ><?php > >namespace test; > >spl_autoload_register(function($name) { > echo "name=$name\n"; >}, true, false, SPL_AUTOLOAD_FUNCTION); > >echo strlen('foo'); >echo strlen('bar'); >echo strlen('baz'); >?> >--EXPECT-- >name=test\strlen >333 > >In my RFC, I mention it is called exactly once. I haven't looked at the PR, only the RFC, and I did not see this very important detail explained anywhere. The only thing I can see is this rather ambiguous sentence: > The function autoloader will not be called again. That could mean not called again for the current call (compared with proposals that call it a second time with the unequalled name); it could mean not called again for the current line of code (based on the current caching behaviour); or never called again for that combination of namespace and name; or possibly, never called again for that combination of namespace, name, and callback function. That's not a small detail of the implementation, it's a really fundamental difference from previous proposals. So I would like to repeat my first response to your RFC: that it should sound more time explaining your approach to the multiple lookup problem. Regards, Rowan Tommins [IMSoP]

« previous php.internals (#125062) next »