Re: [RFC] Syntax for variadic functions

From: Date: Wed, 28 Aug 2013 21:01:31 +0000
Subject: Re: [RFC] Syntax for variadic functions
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
How about having the ellipsis _after_ the variable? That then coincides
with phpDocumentor's recommended syntax of "$c,..." and it keeps any
typehint or & with the variable name ("array &$arr..." versus "array
&...$arr") and, honestly, I think that reads more easily.


On Wed, Aug 28, 2013 at 1:15 PM, Nikita Popov <[email protected]> wrote:

> On Wed, Aug 28, 2013 at 9:27 PM, Matthew Leverton <[email protected]
> >wrote:
>
> > Would any functions get deprecated as a result of this? e.g.,
> > func_get_args()
> >
>
> Nope, func_get_args() etc stay. This is now mentioned in
> https://wiki.php.net/rfc/variadics#userland.
>
>
> > I assume it's a syntax error to do function fn(...$foo, $bar) or
> > function fn(...$foo, ...$bar)
> >
>
> Correct. This is now mentioned in
> https://wiki.php.net/rfc/variadics#syntactic_restrictions.
>
>
> > I assume that function fn($a, $b = null, ...$c) is possible, and the
> > only way to populate $c is to call fn with three or more parameters.
> >
>
> That's also correct :)
>
> Nikita
>


Thread (24 messages)

« previous php.internals (#68652) next »