Re: [RFC] Partial Function Application v2
| From: | Tim Düsterhus | Date: | Fri, 31 Oct 2025 09:22:29 +0000 |
| Subject: | Re: [RFC] Partial Function Application v2 | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-129017@lists.php.net to get a copy of this message | ||
Hi
Am 2025-10-30 19:44, schrieb Larry Garfield:
The one outstanding question is whether we allow reordering using named arguments or preserve the underlying order. Arnaud says either one is doable. So far, only 2 people have commented on it (favoring reordering). We still want feedback from more people to see if there really is a consensus one way or another. (2 people is too small a sample size to draw any conclusions.)It appears there is a larger (and unanimous) agreement. This should be adjusted in the RFC then. Other than that, I've read through the RFC once more and have the following comments: 1. In the //// Regular functions //// examples: I believe the
static is missing from every example. Given that the examples in the Overview at the start already have it, this might be a mistake?
2. // Placeholders may be named, too. Their order doesn't matter.
This example will likely change given the reordering decision, but I'd like to note a typo: The 's' and 'i' parameters in the PFAs are missing their number.
3. (four(c: ?, d: 4, b: ?, a: 1))(2, 3);
This is also a reordering example. Just listing it to make it easier for you to find.
4. Constant expressions
I assume that “nested” PFA will just work? A little more complex example would be good, just to showcase what's possible. How about:
public const BASE = 10;
private \Closure $arrayToInt = \array_map(\intval(?, self::BASE), ?),My understanding is that this should be valid. 5. Implementation notes and optimizations // Transpiles into: The
static should definitely be added here, since you are specifically talking about internal details.
6. Scoping
Seeing the scoping section: Is it possible to partial a parent:: call? I never tried with FCC.
--------------------
All minor clarification bits. I'm super happy with the proposed semantics once the “reordering” question is resolved.
Best regards
Tim Düsterhus