Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:105103 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 73148 invoked from network); 5 Apr 2019 12:13:50 -0000 Received: from unknown (HELO smtpbg202.qq.com) (184.105.206.29) by pb1.pair.com with SMTP; 5 Apr 2019 12:13:50 -0000 X-QQ-mid:Yeas12t1554455372t274t04033 Received: from 90373548D78A4F9A84016F99F658592A (me@jhdxr.com [155.69.203.163]) X-QQ-SSF:00000000000000F0F61000000000000 To: =?UTF-8?Q?'Micha=C5=82_Brzuchalski'?= , "'Rowan Collins'" Cc: "'PHP internals'" References: <003a01d4eaf0$c17d6c20$44784460$@jhdxr.com> <00a401d4eb7c$afa671e0$0ef355a0$@jhdxr.com> In-Reply-To: Date: Fri, 5 Apr 2019 17:09:28 +0800 Message-ID: <00c901d4eb8f$45ecbb20$d1c63160$@jhdxr.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Outlook 16.0 Content-Language: en-us Thread-Index: AQIKWL9sdr8zqvFBmN46rJnDR+4gNwHdTn8dAempWaYCakmlZQH91vGVAqC8ehcBOEjANaViKtHA X-QQ-SENDSIZE: 520 Feedback-ID: Yeas:jhdxr.com:qybgforeign:qybgforeign1 X-QQ-Bgrelay: 1 Subject: RE: [PHP-DEV] [RFC] Spread Operator in Array Expression v0.2 From: me@jhdxr.com (=?utf-8?b?Q0hVIFpoYW93ZWk=?=) If we didn't provide support for string keys, we can add it back later. If we provide this feature, and later we passed named argument with a = different way to handle string keys, then it will be a huge inconsistent = and difficult to fix. Thanks, CHU Zhaowei -----Original Message----- From: Micha=C5=82 Brzuchalski =20 Sent: Friday, April 5, 2019 5:01 PM To: Rowan Collins Cc: PHP internals Subject: Re: [PHP-DEV] [RFC] Spread Operator in Array Expression v0.2 pt., 5 kwi 2019 o 10:50 Rowan Collins = napisa=C5=82(a): > > The original draft discussed this, but there wasn't agreement on how=20 > identical keys should be handled, e.g.: > > $a =3D ['foo' =3D> 1, ...['foo' =3D> 2]] > > Should $['foo'] be 1 or 2? Cases were made for both, and it was=20 > pointed out that if we get named arguments, the argument spread=20 > operator will need to work the same way as whatever is decided for = arrays. > > So the current approach is to get integer keys working first, using=20 > the same behaviour as for parameters, and then revisit string keys = later. > So we're talking about providing incomplete feature now, right? I would opt to the same behaviour as ['foo' =3D> 1] + ['foo' =3D> 2] // = where 'foo' key results in 1 But maybe this should be optional voting for that, either way, we're = delivering feature which has very limited usage which can be confusing, = cause I can array_merge or use + operator so why can't I use keys with = spread operator if I already have them in my generator, iterable or = array which came from for eg. json_decode or whatever. -- regards / pozdrawiam, -- Micha=C5=82 Brzuchalski about.me/brzuchal brzuchalski.com