Hi internals!

I'd like to finish up the argument unpacking proposal (
https://wiki.php.net/rfc/argument_unpacking).

The main open question (or at least the focus of the discussion) seems to
be whether to allow multiple unpacks and trailing arguments.

An example of multiple unpacks is the bind() function:

    function bind(callable $function, ...$boundArgs) {
       return function(...$args) use($function, $boundArgs) {
           return $function(...$boundArgs, ...$args);
        }
    }

This example is detailed a bit more in the RFC:
https://wiki.php.net/rfc/argument_unpacking#partial_applicationmultiple_unpacks

An example of trailing arguments are array intersections and diffs using a
custom compare function:

    array_uintersect(...$arrays, $compare);
    array_udiff(...$arrays, $compare);
    // also array_intersect_uassoc and all those other variations on the
topic

Some people expressed concern about allow both usages (multiple unpacks /
trailing args). I have a bit of a hard time understanding this (as there
clearly are practical applications for both), so I'd appreciate some more
opinions on the topic.

Thanks,
Nikita

Reply via email to