Re: [RFC] Syntax for variadic functions

From: Date: Wed, 28 Aug 2013 16:32:26 +0000
Subject: Re: [RFC] Syntax for variadic functions
References: 1  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
On 28/08/13 17:47, Nikita Popov wrote:
Hi internals! Hi Nikita :-),
I'd like to propose an RFC, which adds dedicated syntax for variadic functions:
     https://wiki.php.net/rfc/variadics
Basically this allows declaring variadics directly in the function signature, rather than fetching the arguments using func_get_args(). Example:
     public function query($query, ...$params) { /* ... */ }
What are your thoughts on this? Huge +1!
So if we call query('foo'), $params is set to an empty array, right? Could it be possible to change this behavior? Would it be interesting? For example: public function query($query, ...$params = null). Cheers. -- Ivan Enderlin Developer of Hoa http://hoa-project.net/ PhD. student at DISC/Femto-ST (Vesontio) and INRIA (Cassis) http://disc.univ-fcomte.fr/ and http://www.inria.fr/ Member of HTML and WebApps Working Group of W3C http://w3.org/

Thread (24 messages)

« previous php.internals (#68642) next »