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

From: Date: Fri, 23 Aug 2024 16:27:35 +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 internals+get-125149@lists.php.net to get a copy of this message
> On 23 Aug 2024, at 22:49, Rowan Tommins [IMSoP] <imsop.php@rwec.co.uk> wrote: > > > > On 23 August 2024 15:04:32 BST, Stephen Reay <php-lists@koalephant.com> wrote: >> >> I stand by the rest of my argument though. This entire ridiculous discussion about a huge >> BC break that introduces bizarre inconsistencies, is 100% because a handful of people don't >> want to type \. > > Again, I'm not sure which straw man you're attacking. I'm not attacking any straw man. I'm calling out the absolutely absurdity of breaking code that has worked for 15 years based on the claim that some people don't want to type a leading backslash. That isn't *my* claim, that's the claim of the original email. > The largest BC break would be to require users to type the leading backslash, So don't then. If people want to rely on the exist fallback as it has existed for 15 years, and don't care about the performance penalty, let them. > in exchange for removing the current "bizarre inconsistencies" and making functions > resolve the same way as classes. The current inconsistencies between symbol types can be avoided in userland in a 100% consistent way. Import or qualify the symbols you use, all the time, and you have 0 inconsistencies or bizarreness in terms of what it used when. Regardless of the specific flavour, swapping the lookup order for *some* symbols to look for global symbols when making unqualified references introduces a hard inconsistency that cannot be rectified in userland, and some flavours (i.e. the original proposal) introduce ongoing-forever BC breakage issues. > Other proposals aim to shift that balance - leaving some inconsistency, but less compatibility > break. Great, how about the solution that doesn't have any BC, and works in every version back to 5.3? > > And most users don't object to using a leading backslash Once again, I didn't claim most users object. I was specifically pointing out that a small number of people complaining about this is a ridiculous reason to even consider the change. Hell the original issue that Ilija referenced makes this outrageous claim, so perhaps direct your "most users" response at the person claiming to represent the views of *all* users on the planet: > All PHP projects in the World are a bit slower than they could be... > , they just (quite reasonably) have no idea what impact it has on the ability of the engine to > optimise their code. Great, so then we can resolve this whole thing by adding a footnote to the "Name resolution rules" page in the manual that (a) recommends using qualified names (i.e. prefix with a \) and (b) provides deeper details of the reasons for those who care. > > Regards, > Rowan Tommins > [IMSoP] >

« previous php.internals (#125149) next »