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

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to