Re: Introduce the abiltiy to use the first-call-callablesyntax on non-static methods, statically
| From: | Christoph M. Becker | Date: | Mon, 23 Jan 2023 22:32:10 +0000 |
| Subject: | Re: Introduce the abiltiy to use the first-call-callablesyntax on non-static methods, statically | ||
| References: | 1 2 3 4 5 6 7 8 9 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-119409@lists.php.net to get a copy of this message | ||
On 23.01.2023 at 19:22, Robert Landers wrote:
> Speaking of partial application, it'd be amazing if it were available
> with the current closure syntax:
>
> $func = fn($x, $y, $z) => echo $x + $y + $z;
> $plus1 = $func(..., 1);
> $plus2n1 = $func(2, 1, ...);
>
> $a = $plus1(1, 2);
> $b = $plus2n1(5);
>
> I spent a few days last summer trying this out, but couldn't get the
> grammar parser to accept it. I think I have a local branch if someone
> would be willing to work on it with me. At least point me in the right
> direction. I don't have much free time these days, but it is certainly
> doable.
There has been an RFC for this[1] (including an implementation), which
had been declined.
[1] <https://wiki.php.net/rfc/partial_function_application>
--
Christoph M. Becker