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

From: Date: Wed, 21 Aug 2024 07:44:10 +0000
Subject: Re: [Concept] Flip relative function lookup order (global, then local)
References: 1 2 3 4 5 6  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
On Wed, Aug 21, 2024, 9:34 AM Christian Schneider <[email protected]>
wrote:

> Am 20.08.2024 um 17:14 schrieb Levi Morrison <[email protected]
> >:
> > Keep in mind that qualifying
> > every global function is annoying but probably can be somewhat
> > automated, and will bring better performance. So again, this improves
> > the existing code even without upgrading.
>
> Just to be sure: Would code *not* using namespaces also have to qualify
> global function calls? I admit that I somewhat skimmed the discussion so I
> might have missed that point.
>
> 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.
>
> Regards,
> - Chris
>

Hi Chris,

You don't have to write additional \,
you can add "use function" statements
 if you prefer that style.
It's no different from referencing global
classes, they either need to be prefixed
 with \ or need to have a corresponding "use" statement.



Kind regards,
Faizan


Thread (112 messages)

« previous php.internals (#125085) next »