Re: [RFC] Argument unpacking

From: Date: Fri, 30 Aug 2013 17:21:09 +0000
Subject: Re: [RFC] Argument unpacking
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-68742@lists.php.net to get a copy of this message
2013/8/30 Stas Malyshev <smalyshev@sugarcrm.com> > Hi! > > > This RFC proposes to add a syntax for argument unpacking: > > > > https://wiki.php.net/rfc/argument_unpacking > > > > Basically, this is the "complement" of the variadics RFC: It is not about > > declaring variadic functions, but about calling them. > > This is just another way of doing call_user_func, I'm not sure we really > need it. And something like: > test(1, 2, ...[3, 4], 5, 6, ...[7, 8]) > > looks plain weird. What would be the use case for doing something like > that? I don't think we should add this. > > Yes, this example is weird, because every argument is hardcoded anyway. I guess it has been added just for completeness. A good example would be function forwarding for variadic functions, without resorting to call_user_func_array. An even better example is that there would be no need to have both call_user_func and call_user_func_array in the first place: The former would be enough. The same applies to userland functions, and I have been many times in a situation where I had to define two different functions to cover both cases. Lazare INEPOLOGLOU Ingénieur Logiciel > -- > Stanislav Malyshev, Software Architect > SugarCRM: http://www.sugarcrm.com/ > (408)454-6900 ext. 227 > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > >

« previous php.internals (#68742) next »