On Mon, Dec 13, 2021, at 5:12 PM, Kirill Nesmeyanov wrote: > I'll add that leading optional parameters are needed to implement > currying and partial application. > > ``` > function foo(int $opt = 42, int $req) {} > > $foo = curry(foo(...), 23); > > // $foo = fn($opt = 42, $req = 23); > ``` > > While this is not a popular practice in PHP, this deprecation > notification «breaks» all code that uses functional pradigm/concepts. > > -- > Kirill Nesmeyanov
This is simply untrue, and I have not seen any code that does currying in that fashion. If anything, trailing optional arguments are what make currying difficult as it's unclear when to "stop" and invoke the underlying function. (The previous PFA RFC had that solved.) I do not like the original proposal here either, though. If we decide we want to allow an argument to require that it be called named, that should have an explicit keyword to indicate such. It should not be an implicit trick of otherwise confusing argument ordering. --Larry Garfield -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php