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

From: Date: Sat, 24 Aug 2024 23:15:17 +0000
Subject: Re: [Concept] Flip relative function lookup order (global, then local)
References: 1 2 3 4 5  Groups: php.internals 
Request: Send a blank email to internals+get-125197@lists.php.net to get a copy of this message
On Sun, Aug 25, 2024, at 00:58, Rowan Tommins [IMSoP] wrote: > > > On 24 August 2024 19:16:13 BST, Stephen Reay <php-lists@koalephant.com> wrote: > > > >> On 25 Aug 2024, at 00:01, Ilija Tovilo <tovilo.ilija@gmail.com> wrote:: > >> > >> 1. Flipping lookup order: ~a few dozens of changes > >> 2. Global only: ~3 000 changes > >> 3. Local only: ~139 000 changes > > >There's also an impact on internals development/RFC with either (1) or (2): *any* > >proposed new global function in the standard library now has a BC barrier to pass if it *might* > >conflict with one defined by anyone in userland, in any namespace. > > Just to correct this point, this is only a problem for option 1. With option 2, if the function > exists only in a namespace, you have to unambiguously refer to that namespaced name (via whatever > syntax), and there is no chance of collision with a global name in future. For me, that's one > of the biggest advantages of that option. > > And to repeat myself: I agree that option 3 is the ideal in theory, but in practice the > short/medium term impact is so big, I'm not convinced it's worth it for the long term > gain. > > Rowan Tommins > [IMSoP] > It may also be worth looking at it a different way: if functions didn’t exist today (such as a 100% OOP language) and we wanted to implement functions: how would we implement it? If it is different than what we have today, the short term impact is almost always worth it; whatever it is. And just to toss out another random aphorism: the short-term pain of change is often better than the long term agony of stagnation. — Rob

« previous php.internals (#125197) next »