Re: [PHP-DEV] Allow default parameters before non-default ones?

2021-12-14 Thread Rowan Tommins
On 13/12/2021 23:12, 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); ``` I'm confused what the optional

Re: [PHP-DEV] Allow default parameters before non-default ones?

2021-12-14 Thread Larry Garfield
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); > ``` > > W

Re: [PHP-DEV] Allow default parameters before non-default ones?

2021-12-14 Thread Kirill Nesmeyanov
>Вторник, 14 декабря 2021, 12:21 +03:00 от Rowan Tommins >: >  >On 13/12/2021 23:12, 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(...)