Re: [PHP-DEV] Argument unpacking - Multiple unpacks and trailing arguments

2013-09-30 Thread Nikita Popov
On Mon, Sep 23, 2013 at 11:18 PM, Robert Stoll wrote: > Personally I would allow multiple unpacking but not allow unpacking for > non-variadic parameters thus: > > function foo(...$arr){} foo(...$arr, ...$arr2); //is fine > function foo(...$arr){} foo(1, 2, ...$arr, ...$arr2); //is fine > funct

RE: [PHP-DEV] Argument unpacking - Multiple unpacks and trailing arguments

2013-09-23 Thread Robert Stoll
> -Original Message- > From: Lars Strojny [mailto:l...@strojny.net] > Sent: Monday, September 23, 2013 9:37 PM > To: Nikita Popov > Cc: PHP internals > Subject: Re: [PHP-DEV] Argument unpacking - Multiple unpacks and trailing > arguments > > Hi Nikita,

Re: [PHP-DEV] Argument unpacking - Multiple unpacks and trailing arguments

2013-09-23 Thread Andrea Faulds
On 23/09/2013 21:19, Nikita Popov wrote: That's a general issue that's not really related to multiple unpacks. It could just as well happen without any unpacks at all ( f(a => 'a', a => 'b') ) or when unpacking an iterator (which is allowed to have duplicate keys). Fair enough. However, I'm a l

Re: [PHP-DEV] Argument unpacking - Multiple unpacks and trailing arguments

2013-09-23 Thread Nikita Popov
On Mon, Sep 23, 2013 at 9:45 PM, Andrea Faulds wrote: > On 23/09/2013 20:33, Nikita Popov wrote: > > The main open question (or at least the focus of the discussion) seems to >> be whether to allow multiple unpacks and trailing arguments. >> >> > I'm not sure I like the idea of multiple unpacks,

Re: [PHP-DEV] Argument unpacking - Multiple unpacks and trailing arguments

2013-09-23 Thread Andrea Faulds
On 23/09/2013 20:33, Nikita Popov wrote: The main open question (or at least the focus of the discussion) seems to be whether to allow multiple unpacks and trailing arguments. I'm not sure I like the idea of multiple unpacks, were we to implement named parameters (if you did f(...(['a' => 2]

Re: [PHP-DEV] Argument unpacking - Multiple unpacks and trailing arguments

2013-09-23 Thread Lars Strojny
Hi Nikita, Am 23.09.2013 um 21:33 schrieb Nikita Popov : [...] > An example of trailing arguments are array intersections and diffs using a > custom compare function: > >array_uintersect(...$arrays, $compare); >array_udiff(...$arrays, $compare); >// also array_intersect_uassoc and all