Re: Re: Allow combining arg unpacking and named args
| From: | Levi Morrison via internals | Date: | Thu, 10 Jun 2021 15:50:07 +0000 |
| Subject: | Re: Re: Allow combining arg unpacking and named args | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-114817@lists.php.net to get a copy of this message | ||
On Thu, Jun 10, 2021 at 7:14 AM Nikita Popov <nikita.ppv@gmail.com> wrote:
>
> On Tue, May 25, 2021 at 4:18 PM Nikita Popov <nikita.ppv@gmail.com> wrote:
>
> > Hi internals,
> >
> > Currently, argument unpacking (...$foo) cannot be combined with named
> > arguments (foo: $bar) at all. Both func(...$args, x: $y) and func(x: $y,
> > ...$args) are rejected by the compiler.
> >
> > https://github.com/php/php-src/pull/7009 relaxes this by
> > allowing
> > func(...$args, x: $y). The named arguments are required to come last,
> > because this automatically enforces the invariant that named arguments must
> > be sorted after positional argument.
> >
> > Are there any concerns with relaxing this restriction?
> >
>
> Any further feedback on this?
>
> Nikita
No objection. In my head I figured the unpack would come after named
parameters, but it makes sense that an unpack which can contain both
positional and named arguments would come between the positional and
named arguments.