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

From: Date: Fri, 23 Aug 2024 13:28:33 +0000
Subject: Re: [Concept] Flip relative function lookup order (global, then local)
References: 1 2 3 4 5 6 7 8 9 10 11 12  Groups: php.internals 
Request: Send a blank email to internals+get-125141@lists.php.net to get a copy of this message
> On Aug 23, 2024, at 9:07 AM, Rowan Tommins [IMSoP] <imsop.php@rwec.co.uk> wrote: > > On Fri, 23 Aug 2024, at 13:45, Mike Schinkel wrote: >>> On Aug 23, 2024, at 8:33 AM, Rowan Tommins [IMSoP] <imsop.php@rwec.co.uk> wrote: >>> On 23 August 2024 13:04:22 BST, Mike Schinkel <mike@newclarity.net> wrote: >>>> And how can it occur without an explicit use >>>> AcmeComponents\SplineReticulator\Utilities\Text\Text statement, which I proposed >>>> would override the automatic use, anyway? >>> >>> I'm not sure what you mean. Right now, that's the function name that would be >>> looked up for your example code (other than a couple of unrelated typos in your example). So if, for >>> some reason, someone was relying on that, their code would break with your "automatic >>> use". >> >> I must be missing something. Can you give a specific example showing >> how the automatic use would conflict with something other than a root >> namespace? > > You already gave the example yourself, you just misunderstood what its current behaviour is. > Here it is, with the typos fixed: https://3v4l.org/6eD3N > > As you can see from the error message, it doesn't look up "Text\strlen()", it > looks up "AcmeComponents\SplineReticulator\Utilities\Text\Text\strlen()" > > Or to be even clearer: https://3v4l.org/ojVcP Thank you for clarifying. You got me there. And it is a good illustration why I continue to really dislike how namespaces work. Too many footguns that are too easy to misunderstand. But it is what it is, I guess. -Mike

« previous php.internals (#125141) next »