Re: [RFC] Partial Function Application v2

From: Date: Fri, 17 Oct 2025 08:10:46 +0000
Subject: Re: [RFC] Partial Function Application v2
References: 1 2 3 4 5 6  Groups: php.internals 
Request: Send a blank email to internals+get-128857@lists.php.net to get a copy of this message
Hi

Am 2025-10-13 20:23, schrieb Larry Garfield:
OK, there was a miscommunication between Arnaud and I. It is using the variable name, not "args" already. Just with no _ and 0-based. I've updated the RFC accordingly.
Thank you! I noticed a small typo in one of the updated examples: $c = fn(int $i1, ?float $f3, Point $points0, Point $points`): string => things($i1, $f3, $points0, $points1); The second points parameter is misnamed.
We talked a bit more, and decided to tighten the rules further. I've updated the RFC accordingly. Essentially, the first example is correct, the second has been changed. If the underlying function is variadic, and ... is used in the PFA, then it will accept an arbitrary number of arguments. In any other case, only explicitly-specified arguments will be passed through.
The RFC still says: // Whereas strictly speaking, a variadic placeholder is equivalent to this: $f = foo(1, ...); $f = fn(int $b, int $c): int => foo(1, $b, $c, $d, ...array_slice(func_get_args(), 3)); Did you miss updating that? This also makes me realize that this means that PFA will not actually be a strict superset of FCC, no? FCC always passes through all the extra arguments, whereas PFA will not (at least based on your reply). Best regards Tim Düsterhus

Thread (54 messages)

« previous php.internals (#128857) next »