Re: [Concept] Flip relative function lookup order (global, then local)

From: Date: Wed, 21 Aug 2024 09:22:40 +0000
Subject: Re: [Concept] Flip relative function lookup order (global, then local)
References: 1 2 3 4 5 6 7  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
Am 21.08.2024 um 09:44 schrieb Faizan Akram Dar <[email protected]>:
> On Wed, Aug 21, 2024, 9:34 AM Christian Schneider <[email protected]> wrote:
>> The point where I think we disagree is that it improves the code. It may improve
>> performance of the code (even though I somewhat doubt this has a *significant* impact on most
>> projects) but it IMHO hurts readability. Writing the additional \ is less of a problem but as code
>> is read a lot more often than written I think the additional "line-noise" is something
>> I'd like to avoid.
> 
> You don't have to write additional \, 
> you can add "use function" statements
>  if you prefer that style. 

I think that is trading one problem for another:
- Having to declare all global functions like strlen with 'use' is (IMHO) unnecessary
boilerplate which also needs to be kept in sync with the rest of the code below
- I am generally wary of top declarations changing "semantics" of code further down the
line. Being able to tell what is being done without (far away) context is a feature and that's
why I e.g. prefer foo($GLOBALS['bar']) to global $bar; ... foo($bar).

Regards,
- Chris


Thread (112 messages)

« previous php.internals (#125088) next »