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. Now, if we had named arguments, like python had, then using "some value" as a named argument might work (and we'd need to see what to do with named arguments in this case), but as positional argument this just doesn't make much sense beyond some very esoteric things that nobody uses directly, without wrapping libraries (like partially applied functions) - at least in PHP. > And I think you are really arguing about non-issues. > Example: Multiple uses of unpacking syntax makes sense when you call a > function with a variadic parameter: > > function variadic (...$args) { > // do something > } > > variadic(...$array1, ...$array2); Again, since parameters in PHP are positional, they have meaning depending on position. If you just wanted to pass an array, pass an array, you don't need to use variadic syntax for that. Variadic syntax makes sense only if positions there have meanings and you want to give specific meanings to specific arguments in specific positions. In that case, ...$array1, ...$array2 doesn't work since you can not have meaningful positions. Only case where it works if you do functional operations like partial application, where the meaning of the function is not important but only the fact that it is a function is important. But I don't think we need special syntax to do such things. -- 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