Hey folks,

Currently argument unpacking can only be used once in a call and only after all positional arguments were passed. E.g. func(1, 2, 3, ...[4, 5]) is allowed, but func(...[1, 2, 3], 4, ...[5]) is not.

This makes it impossible to use this feature with some of the ext/std functions (array_udiff, array_interect_ukey, etc.) and just feels a bit incomplete...

I would like to propose to allow usage of argument unpacking at any place in arguments you are passing.

The patch is pretty simple, you look at it here: https://github.com/nikita2206/php-src/compare/master...unpack-mid-argument-list

I still haven't tested performance on the real life apps, but all the synthetic benchmarks (incl. deep recursion in order to let call stack go over the cpu cache) show that there's no difference between this patch and master. Callgrind shows that there is a small increase in the number of instructions ran, which is expected but seems as to be negligible. (It's about 0.5% increase for recursion benchmark).

I'm not sure if this change requires an RFC because this is a pretty small, advancement of already existing feature that doesn't contain any BC breaks. So I would be happy if this could go forward without it, but if people disagree here I will make an RFC, that's not a problem (although I would need some karma...)

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to