Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:105101 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 69016 invoked from network); 5 Apr 2019 12:05:25 -0000 Received: from unknown (HELO poczta.brzuchalski.com) (188.165.245.118) by pb1.pair.com with SMTP; 5 Apr 2019 12:05:25 -0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by poczta.brzuchalski.com (Postfix) with ESMTP id 41EDA2984239 for ; Fri, 5 Apr 2019 11:01:16 +0200 (CEST) Received: from poczta.brzuchalski.com ([127.0.0.1]) by localhost (poczta.brzuchalski.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 0KB2K9V28_AL for ; Fri, 5 Apr 2019 11:01:14 +0200 (CEST) Received: from mail-lf1-f41.google.com (unknown [209.85.167.41]) by poczta.brzuchalski.com (Postfix) with ESMTPSA id 3332C2984233 for ; Fri, 5 Apr 2019 11:01:14 +0200 (CEST) Received: by mail-lf1-f41.google.com with SMTP id g7so3816106lfh.10 for ; Fri, 05 Apr 2019 02:01:14 -0700 (PDT) X-Gm-Message-State: APjAAAVf6GfG74Moa+/EC2PpeoHVVQgE1AFk0/+iIQwN+I1eHy2CunjT Gl/QWoY9IGgqg9QbSqQMEZlKtmiKf9LGO205zVM= X-Google-Smtp-Source: APXvYqy89iIQfOla5lVxbDxDRFAv0gFVx6w9sRGOp7IObc6RboxC9tQQEwRR9JSsF99+zwMj3w0X98o3qzsyRZTsBeA= X-Received: by 2002:a19:f50f:: with SMTP id j15mr5826771lfb.126.1554454873674; Fri, 05 Apr 2019 02:01:13 -0700 (PDT) MIME-Version: 1.0 References: <003a01d4eaf0$c17d6c20$44784460$@jhdxr.com> <00a401d4eb7c$afa671e0$0ef355a0$@jhdxr.com> In-Reply-To: Date: Fri, 5 Apr 2019 11:00:59 +0200 X-Gmail-Original-Message-ID: Message-ID: To: Rowan Collins Cc: PHP internals Content-Type: multipart/alternative; boundary="00000000000090a94b0585c4ba8a" Subject: Re: [PHP-DEV] [RFC] Spread Operator in Array Expression v0.2 From: michal@brzuchalski.com (=?UTF-8?Q?Micha=C5=82_Brzuchalski?=) --00000000000090a94b0585c4ba8a Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 > 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 pointed o= ut > that if we get named arguments, the argument spread 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 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] // whe= re '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. --=20 regards / pozdrawiam, -- Micha=C5=82 Brzuchalski about.me/brzuchal brzuchalski.com --00000000000090a94b0585c4ba8a--