Allow combining arg unpacking and named args
| From: | Nikita Popov | Date: | Tue, 25 May 2021 14:18:12 +0000 |
| Subject: | Allow combining arg unpacking and named args | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-114589@lists.php.net to get a copy of this message | ||
Hi internals,
Currently, argument unpacking (...$foo) cannot be combined with named
arguments (foo: $bar) at all. Both func(...$args, x: $y) and func(x: $y,
...$args) are rejected by the compiler.
https://github.com/php/php-src/pull/7009
relaxes this by allowing
func(...$args, x: $y). The named arguments are required to come last,
because this automatically enforces the invariant that named arguments must
be sorted after positional argument.
Are there any concerns with relaxing this restriction?
Regards,
Nikita