On 10 August 2022 18:52:58 BST, Alex Wells <autau...@gmail.com> wrote: >Thanks for explaining it better than I did. > >Regarding the implementation, that was roughly what I was thinking. > >But can't we put extension methods second, after real methods but before >__call? As far as I understand, the reason to put it after __call is to >avoid a performance penalty on __call calls, but this would mean extension >methods are not possible for classes that implement __call. Not a huge >deal, but a thing to consider.
To be honest, I put them in that order more for "purity" reasons: if they come before __call, they can change the existing behaviour of the class, by defining an extension method with the same name as a "virtual" method implemented with __call. That then becomes a very different feature. If there was a way for __call to signal "no implementation for this method name", you could look for extension methods if that was returned; but at the moment, a class implementing __call is assumed to reserve *all* method names. I suppose a related question is whether __call itself could be implemented by an extension method. I would suggest no, to keep things simpler. (Aside: Reminder that convention on this list is to "bottom-post": quote the part of message you're replying to, then add your text below.) -- Rowan Tommins [IMSoP] -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php