Re: [RFC]
| From: | Rowan Tommins | Date: | Fri, 14 Feb 2020 00:24:30 +0000 |
| Subject: | Re: [RFC] | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-108555@lists.php.net to get a copy of this message | ||
On 13 February 2020 18:19:08 GMT+00:00, Mike Schinkel <mike@newclarity.net> wrote:
>Eloquently maybe, but of limited vision.
I think that's a rather negative way of putting it; there was a request for use cases, and you
have supplied some, so thank you. :)
An idea I had earlier which might solve some of them is if what was returned was not a normal
Closure instance, but a new class like FunctionReference. It could then "remember" the
name of the function wrapped, and implement __toString, Serializable, etc. It could inherit from
Closure, so instanceof checks would work, and bindTo would return a normal Closure. I'm sure
there's downsides I haven't thought of yet, but I thought I'd throw the idea into the
mix.
A possible future direction would then be to have ::class return some kind of ClassRef object, with
the obvious downside that it would no longer pass string type hints without casting. I'm also
not sure what the object would do, other than feel nicer from a type system point of view.
Regards,
--
Rowan Tommins
[IMSoP]