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