Hi folks.  After much off-list discussion, iteration, and consideration, we 
have a new draft of PFA ready for review.

The URL is the same:

https://wiki.php.net/rfc/partial_function_application

It's a bit long because we wanted to be as precise as possible.  However, in 
short:

* Partial application creates a closure object you can use like any other.
* A ? indicates "exactly one required parameter here"
* A ... indicates "zero or more parameters here"
* If the pattern in the partial is compatible with the underlying function, 
everything "just works"
* If it's not compatible, you get an error.
* Named placeholders are not supported.
* Splat (argument unpacking) is not supported.

That gives us the 3 most important use cases, plus many others:

arbitrary_function(...) works to reference any function safely.  (This is what 
Nikita's mini-scoped proposal did.)

some_func(1, 2, ?, 5) works to reduce any function to single-argument, which 
makes it useful in many callback situations.

any_func($all, $params, ...) works to provide all the arguments to a function 
but not call it yet; you can then cal the resulting closure later with no 
arguments to actually invoke it.

We're reasonably confident that we have all the ins and outs covered, and in a 
performant way.  Because it's such a heavy rework, though, we want to give it 
enough time for the discussion to settle, so won't call a vote for at least 2 
weeks from today (give or take the feedback we get here).

Cheers!

-- 
  Larry Garfield
  la...@garfieldtech.com

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

Reply via email to