Re: [PHP-DEV] [RFC] Argument unpacking

2015-06-05 Thread Yo-An Lin
Laruence laruence at php.net writes: On Fri, Aug 30, 2013 at 11:23 PM, Nikita Popov nikita.ppv at gmail.com wrote: Hi internals! This RFC proposes to add a syntax for argument unpacking: https://wiki.php.net/rfc/argument_unpacking Basically, this is the complement of the

Re: [PHP-DEV] [RFC] Argument unpacking

2015-06-05 Thread Rowan Collins
Yo-An Lin wrote on 05/06/2015 06:51: Laruence laruence at php.net writes: On Fri, Aug 30, 2013 at 11:23 PM, Nikita Popov nikita.ppv at gmail.com wrote: Hi internals! This RFC proposes to add a syntax for argument unpacking: https://wiki.php.net/rfc/argument_unpacking Basically, this

Re: [PHP-DEV] [RFC] Argument unpacking

2013-08-31 Thread Nikita Popov
On Fri, Aug 30, 2013 at 11:50 PM, Stas Malyshev smalys...@sugarcrm.comwrote: If staying consistent with foreach is not wanted (or this is not How calling a function can be consistent with foreach? Those are different things. Calling a function should be consistent with all other cases of

Re: [PHP-DEV] [RFC] Argument unpacking

2013-08-31 Thread Adam Harvey
On 31 August 2013 03:21, Nikita Popov nikita@gmail.com wrote: This is very special use case to be hidden in library functions, I don't think we need to have language syntax specially directed at that, at the cost of making it overall more complex and hard to understand. I can see what add

Re: [PHP-DEV] [RFC] Argument unpacking

2013-08-31 Thread Adam Harvey
On 30 August 2013 08:23, Nikita Popov nikita@gmail.com wrote: The syntax it introduces looks as follows: $db-query($query, ...$params); Somebody was going to do this, and it's going to be me. Sorry. We were doing so well. I don't like the ellipsis. I could just about deal with it for

Re: [PHP-DEV] [RFC] Argument unpacking

2013-08-31 Thread Sara Golemon
Big +1 from me, though as Stas pointed out, multiple unpacks in a single call don't really work with PHP parameter typing, so I'd make that use an error. On Sat, Aug 31, 2013 at 10:57 AM, Adam Harvey ahar...@php.net wrote: On 30 August 2013 08:23, Nikita Popov nikita@gmail.com wrote: The

Re: [PHP-DEV] [RFC] Argument unpacking

2013-08-31 Thread Pierre Joye
hi Nikita! On Fri, Aug 30, 2013 at 5:23 PM, Nikita Popov nikita@gmail.com wrote: Hi internals! 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

Re: [PHP-DEV] [RFC] Argument unpacking

2013-08-30 Thread Levi Morrison
On Fri, Aug 30, 2013 at 10:33 AM, Laruence larue...@php.net wrote: On Fri, Aug 30, 2013 at 11:23 PM, Nikita Popov nikita@gmail.com wrote: Hi internals! This RFC proposes to add a syntax for argument unpacking: https://wiki.php.net/rfc/argument_unpacking Basically, this is

Re: [PHP-DEV] [RFC] Argument unpacking

2013-08-30 Thread Nikita Popov
On Fri, Aug 30, 2013 at 6:57 PM, Stas Malyshev smalys...@sugarcrm.comwrote: 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? No use case at all. This is a technical specification, so I write down what is

Re: [PHP-DEV] [RFC] Argument unpacking

2013-08-30 Thread Stas Malyshev
Hi! Assuming you mean call_user_func_array, yes. This is just syntax sugar for call_user_func_array. Advantages of this syntax over cufa are outlined here: https://wiki.php.net/rfc/argument_unpacking#advantages_over_call_user_func_array The only case that I see that could make sense is

Re: [PHP-DEV] [RFC] Argument unpacking

2013-08-30 Thread Stas Malyshev
Hi! A good example would be function forwarding for variadic functions, without resorting to call_user_func_array. What's wrong with resorting to call_user_func_array? call_user_func_array is a PHP function and not some dark magic that one should avoid using unless it is absolutely must. --

Re: [PHP-DEV] [RFC] Argument unpacking

2013-08-30 Thread Lazare Inepologlou
2013/8/30 Stas Malyshev smalys...@sugarcrm.com Hi! A good example would be function forwarding for variadic functions, without resorting to call_user_func_array. What's wrong with resorting to call_user_func_array? call_user_func_array is a PHP function and not some dark magic that one

[PHP-DEV] [RFC] Argument unpacking

2013-08-30 Thread Nikita Popov
Hi internals! 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. The syntax it introduces looks as follows:

Re: [PHP-DEV] [RFC] Argument unpacking

2013-08-30 Thread Lazare Inepologlou
2013/8/30 Stas Malyshev smalys...@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.

Re: [PHP-DEV] [RFC] Argument unpacking

2013-08-30 Thread Nikita Popov
On Fri, Aug 30, 2013 at 7:45 PM, Stas Malyshev smalys...@sugarcrm.comwrote: Hi! Assuming you mean call_user_func_array, yes. This is just syntax sugar for call_user_func_array. Advantages of this syntax over cufa are outlined here:

Re: [PHP-DEV] [RFC] Argument unpacking

2013-08-30 Thread Laruence
On Fri, Aug 30, 2013 at 11:23 PM, Nikita Popov nikita@gmail.com wrote: Hi internals! 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

Re: [PHP-DEV] [RFC] Argument unpacking

2013-08-30 Thread Andrey Hristov
On 08/30/2013 05:23 PM, Nikita Popov wrote: Hi internals! 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.

Re: [PHP-DEV] [RFC] Argument unpacking

2013-08-30 Thread Stas Malyshev
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,

Re: [PHP-DEV] [RFC] Argument unpacking

2013-08-30 Thread Lazare Inepologlou
2013/8/30 Stas Malyshev smalys...@sugarcrm.com don't see a reason why one should explicitly disallow doing multiple unpacks. Because it makes very hard to understand what's going on and makes no sense semantically. As you can see, here two arguments are unpacked in one call. This is

Re: [PHP-DEV] [RFC] Argument unpacking

2013-08-30 Thread Stas Malyshev
Hi! Not sure I get what you mean. All languages with argument unpacking allow this. It's not commonly needed, but there are uses for it and I I mean this: a = [0,3] range(*a) [0, 1, 2] a = [1]; b = [2] range(*a, *b) File stdin, line 1 range(*a, *b) ^ SyntaxError:

Re: [PHP-DEV] [RFC] Argument unpacking

2013-08-30 Thread Bob Weinand
Hi! Am 31.8.2013 um 00:27 schrieb Lazare Inepologlou linep...@gmail.com: 2013/8/30 Stas Malyshev smalys...@sugarcrm.com don't see a reason why one should explicitly disallow doing multiple unpacks. Because it makes very hard to understand what's going on and makes no sense semantically.

Re: [PHP-DEV] [RFC] Argument unpacking

2013-08-30 Thread Stas Malyshev
Hi! function short (...$args) { if (count($args)) return long(...$args, some value); } This is exactly the problem. Since $args has undefined number of arguments, there's no way to determine where some value ends up. Which means it's impossible to understand what's going on here.

Re: [PHP-DEV] [RFC] Argument unpacking

2013-08-30 Thread Lazare Inepologlou
2013/8/31 Bob Weinand bobw...@hotmail.com Hi! Am 31.8.2013 um 00:27 schrieb Lazare Inepologlou linep...@gmail.com: 2013/8/30 Stas Malyshev smalys...@sugarcrm.com don't see a reason why one should explicitly disallow doing multiple unpacks. Because it makes very hard to understand

Re: [PHP-DEV] [RFC] Argument unpacking

2013-08-30 Thread Bob Weinand
Hi! Am 31.8.2013 um 01:39 schrieb Stas Malyshev smalys...@sugarcrm.com: Hi! function short (...$args) { if (count($args)) return long(...$args, some value); } This is exactly the problem. Since $args has undefined number of arguments, there's no way to determine where some

Re: [PHP-DEV] [RFC] Argument unpacking

2013-08-30 Thread Bob Weinand
Hi! Am 31.8.2013 um 01:39 schrieb Lazare Inepologlou linep...@gmail.com: 2013/8/31 Bob Weinand bobw...@hotmail.com Hi! Am 31.8.2013 um 00:27 schrieb Lazare Inepologlou linep...@gmail.com: 2013/8/30 Stas Malyshev smalys...@sugarcrm.com don't see a reason why one should explicitly