Re: [RFC] Add Directive to Make All Namespaced Function Calls Global
| From: | Marco Pivetta | Date: | Sun, 04 Aug 2024 12:23:23 +0000 |
| Subject: | Re: [RFC] Add Directive to Make All Namespaced Function Calls Global | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-124735@lists.php.net to get a copy of this message | ||
Hey Nick,
On Sun, 4 Aug 2024 at 13:42, Nick Lockheart <lists@ageofdream.com> wrote:
> This also prevents the parser from using dedicated opcodes for built-in
> functions.
>
> This incurs a performance penalty.
>
For many, many years, tools like
doctrine/coding-standard have imported
global functions.
The performance benefit is minimal and opt-in at very minimal effort for
userland (literally "run a decent coding standards tool").
Changing this behavior breaks use-cases like shadowing internal functions,
which are useful for testing / stubbing / etc. I disagree with the
technique, but it is a valid and relied-upon use-case nonetheless.
Better ways forward:
* endorse userland to use a CS tool
* namespace performance-sensitive PHP functions, so we can exclude the
entire problem, by having people use the namespaced variant :P
Marco Pivetta
https://mastodon.social/@ocramius
https://ocramius.github.io/