Re: Introduce the abiltiy to use the first-call-callable syntax on non-static methods, statically
| From: | Ollie Read | Date: | Mon, 23 Jan 2023 16:53:26 +0000 |
| Subject: | Re: Introduce the abiltiy to use the first-call-callable syntax on non-static methods, statically | ||
| References: | 1 2 3 4 5 6 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-119401@lists.php.net to get a copy of this message | ||
There's definitely similarity, but I would say it sits somewhere between the two. Rather than
reference a partial method call, or create a closure for a method, you're delaying a method
call. Or rather, referencing a method. We have the ::class pseudo property, so I see this like an
equivalent, but for methods.
On Mon, Jan 23, 2023, at 4:50 PM, Deleu wrote:
>
>
> On Mon, Jan 23, 2023, 1:16 PM Ollie Read <php@ollie.codes> wrote:
>> Oh, I didn't mean to suggest that it automatically binds.
>>
>> My second suggestion for how to achieve this does require some sort of automation. If you
>> create a closure from Str::someMethod($arg1, $arg2) where someMethod isn't static, it should
>> create a closure with the signature fn(Str $object, $arg1, $arg2), which would wrap a call to
>> [$object, 'someMethod]($arg1, $arg2).
>
> I think this starts to wonders in the realm of Partial Function Application
> https://wiki.php.net/rfc/partial_function_application
>
---
Best Regards,
*Ollie Read*