Le vendredi 5 avril 2019, 11:00:59 CEST Michał Brzuchalski a écrit :
> So we're talking about providing incomplete feature now, right?

As I understand it, the point is to make unpacking available to arrays, to be 
consistent with function calls.

// This is already supported
$result = someFunction($a, $b, ...$array);
$result = new someClass($a, $b, ...$array);

// This is not
$result = array($a, $b, ...$array);

So when building an object I can unpack, but not when building an array, why?

So the feature is designed to work the same way as for function parameters, 
which is why string keys are not supported, because they are not supported by 
the "..." operator for functions.

In the end, I see that as making a feature more complete, as the "..." operator 
which only supported functions will now support array constructors as well.

Côme

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

Reply via email to