On Thu, Oct 15, 2015 at 10:04 PM, Sara Golemon <poll...@php.net> wrote:

> On Thu, Oct 15, 2015 at 12:51 PM, Ryan Pallas <derokor...@gmail.com>
> wrote:
> > I do h ave one question I just thought of though... how does the
> allowance
> > of trailing comma work with the splat operator (...)? I'm assuming a
> > function call/definition may only have one or the other, is that correct?
> >
> Excellent question.  The patch on Sammy's RFC was written in Feb 2013,
> before variadics, so it doesn't take them into account.
>
> I would say that it should be modified to disallow a trailing comma
> following either a variadic declaration or a splat invocation, since
> the grammar around these two things prohibits followups anyway.
>

We allow multiple splats in one call. Something like this (after trailing
comma patch) should be just fine:

    foo(
        ...$args,
        ...$moreArgs,
        ...$evenMoreArgs,
    );

We don't allow multiple variadic parameters. However I also see little
point in explicitly forbidding this one case. You'd be able to use the
trailing comma in all cases ... apart from that one single instance.

Nikita

Reply via email to