Well, I think this answer the first question. Since consistency is king, why 
not just applying the same behavior than without spread operator? What do you 
think ?

De : Côme Chilliet<mailto:come.chill...@fusiondirectory.org>
Envoyé le :mercredi 3 juin 2020 17:02
À : internals@lists.php.net<mailto:internals@lists.php.net>
Objet :Re: [PHP-DEV] RFC proposal: Spread Operator for Array Destructuring 
Assignment

Le Wed, 3 Jun 2020 11:46:00 +0200,
Nikita Popov <nikita....@gmail.com> a écrit :
> To give a tl;dr of existing discussions on the topic:
>
>     $foobar = [2 => 2, 1 => 1, 0 => 0];
>     [$foo, ...$bar] = $foobar;
>     // What is the result?
>
> Introducing this feature is primarily a matter of coming up with a
> satisfactory answer to the above question. (There is an existing
> constraint that $foo must be equal to 0 in this case, not 2.)

Well, I guess it should behave exactly the same as:

     $foobar = [2 => 2, 1 => 1, 0 => 0];
     [$foo, $foo2, $foo3] = $foobar;
     $bar = [$foo2, $foo3];

for consistency, no?


Reply via email to