Re: [RFC]

From: Date: Thu, 13 Feb 2020 07:33:58 +0000
Subject: Re: [RFC]
References: 1 2 3 4 5 6 7 8 9  Groups: php.internals 
Request: Send a blank email to internals+get-108530@lists.php.net to get a copy of this message
On 13 February 2020 03:33:32 GMT+00:00, Mike Schinkel <mike@newclarity.net> wrote: >> On Feb 12, 2020, at 5:47 PM, Rowan Tommins <rowan.collins@gmail.com> >wrote: >> >> On 12/02/2020 03:58, Mike Schinkel wrote: >>> Returning a_closure_ instead of a string would be providing a >feature we_already_ have instead of one we do_not_ have. >> >> >> Not really, because you still need a way to get the fully-qualified >name of the function. This is not valid: >> >> namespace MyVendor\Something\Foo; >> function bar() {} >> >> \Closure::fromCallable('bar'); # Error: tries to resolve function >'\bar' >> > >Why would ::function return a short name instead of the fully-qualified >name? I never said it would; the intent of this example was to show what is possible in current PHP, in response to your comment about returning a closure being "a feature we already have". The key new feature being proposed is a way to resolve an unqualified function name based on current namespace and imports, without calling the function. The open question is whether the result of that should be expressed as a string or as a Closure object, but in current PHP the feature doesn't exist at all. Regards, -- Rowan Tommins [IMSoP]

« previous php.internals (#108530) next »