Re: [Concept] Flip relative function lookup order (global, then local)
| From: | Nick Lockheart | Date: | Tue, 20 Aug 2024 08:41:23 +0000 |
| Subject: | Re: [Concept] Flip relative function lookup order (global, then local) | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-125065@lists.php.net to get a copy of this message | ||
> We would upgrade that to a warning in PHP 9.2, and it would end up
> being an error on PHP 10 and have a BC break.
>
> I don't think adding a \ to each function call is ugly, that's what
> we have for classes, and it works fine; or an use statement.
>
> So, why do we think that after people get used to it, they would
> still consider it ugly? Never heard the "ugliness" mentioned for
> classes.
Respectfully, I think
\ is ugly for both functions and classes.
> Now, I know this would be a big BC break, but it brings consistency
> to the language and forces everyone to improve their code
> performance.
There should be a directive for this, like:
namespace foo using global functions;
...which automatically acts as if all functions have a \ in front of
them, unless they are fully qualified.