On Sat, Jun 28, 2025, at 12:06 AM, Larry Garfield wrote:
> Hi folks.  Arnaud and I would like to present take-2 at Partial 
> Function Application.
>
> https://wiki.php.net/rfc/partial_function_application_v2
>
> It is largely similar to the previous PFA proposal from 2021, though 
> there are a number of changes.  Most notably:
>
> * The implementation is simpler, because FCC already did part of the 
> work.  This RFC can build on it.
> * Constructors are not supported.
> * But optional arguments and named placeholders are supported.
> * It includes pipe-based optimizations.
>
> Note: We realize that this is a non-trivial RFC coming late in the 
> cycle.  We are proposing it now because, well, it's ready now.  If the 
> discussion goes smoothly, we're OK calling a vote on it for 8.5, 
> especially as it would complement pipes so well.  If the discussion 
> runs longer, we're also OK with targeting 8.6 instead.  We'll see how 
> that goes.
>
> <floor opens for discussion, Larry falls through the trap door>

Hi folks.  Just a quick update: We've made one small change to the RFC.  
Specifically, in order to prevent accidentally calling optional arguments from 
callback locations like array_map() or array_find(), a partial created with 
foo(?) will ignore any additional arguments passed to it, and will not pass 
those through to the underlying function.  A partial that uses foo(?, ...) will 
pass through whatever it gets.

This is mainly to avoid passing an array key from those functions to a callback 
function that has an optional second parameter, which is not intended to get a 
key string.  In practice this is what most people would expect would happen, 
but we're calling it out explicitly.  (I'm not even sure it's a behavior change 
from what we had before, in practice.)

cf: 
https://wiki.php.net/rfc/partial_function_application_v2#extraneous_arguments

It seems the discussion has quieted down and wasn't particularly contentious to 
begin with (whew), so we're just about ready for a vote.  However, Arnaud went 
on vacation and didn't remember to tell me when he'd be back. :-)  So I'm going 
to wait a few more days just in case he has any last minute comments, but start 
the vote either when he returns or Monday the 28th, whichever comes first.  
(That gets the vote complete before the deadline for 8.5.)

--Larry Garfield

Reply via email to