Re: [RFC] Spread Operator in Array Expression

From: Date: Mon, 19 Nov 2018 09:00:27 +0000
Subject: Re: [RFC] Spread Operator in Array Expression
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-103453@lists.php.net to get a copy of this message
Hi, I worked together with Chris Wright, author of the other RFC covering the same thing. You will find there is very little agreement on how this should work, which is the reason the RFC stalled... not because we didn't try. The most important thing is that we don't want it work like array_merge(); in other words, it must not cover both lists and maps at the same time. What you are proposing overlaps the $arr1 + $arr2 operator functionality. Everything boils down to this: ["a" => 1, "b" => 2, ...["a" => 3]] is this equal to ["b" => 2, "a" => 3] imo reasonable... "ordered map concat". ie not only it overwrites the value, but it also re-positions the key or is it equal to ["a" => 3, "b" => 2] overlaps the functionality of the + operator (bad idea imo) or is it equal to ["a" => 1, "b" => 2, 0 => 3] ie discards the key, works like array_push() ?

« previous php.internals (#103453) next »