Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:78736 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 69044 invoked from network); 5 Nov 2014 17:10:39 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Nov 2014 17:10:39 -0000 Authentication-Results: pb1.pair.com header.from=are.you.winning@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=are.you.winning@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.51 as permitted sender) X-PHP-List-Original-Sender: are.you.winning@gmail.com X-Host-Fingerprint: 209.85.216.51 mail-qa0-f51.google.com Received: from [209.85.216.51] ([209.85.216.51:38938] helo=mail-qa0-f51.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 65/D3-50436-E0A5A545 for ; Wed, 05 Nov 2014 12:10:38 -0500 Received: by mail-qa0-f51.google.com with SMTP id f12so780655qad.24 for ; Wed, 05 Nov 2014 09:10:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:cc:content-type; bh=LJClhAGA1SniEIeWFfHiWy/N7A9HPzIQnFhcvNTSJZw=; b=djGiAzJ/gXYhrDzfMVRUat3hXS9a3G6hOWK+DrezjPqPkchqIYwZoPjnrDNgStDFW6 KkLvEKhSR5RSNM/4xaTl5qERyDeXSO79KEE54SxCBR/vyAvkjepFjOGKcSeiUAt95tga vSvYNgeo9Xy4d3ZVVwr5lx8OMMw2pCdMx9hzzShJsCKhEs0Sn8s50DIik42dy47lhSMN nokFGwEf5gHJX2OR+zeaSsl4Iy0CVcRk+G6AtjHJELAPQhJsUCIyA/qtjvxogasvZ0Ke qPxBNwIZrkuMnubVPb7LYL/nmhwjsyHcHuKYK9Pe+2ofSJbM7h11kwiv+fOWRmPbjFAd vVsg== MIME-Version: 1.0 X-Received: by 10.224.114.79 with SMTP id d15mt66258496qaq.29.1415207436003; Wed, 05 Nov 2014 09:10:36 -0800 (PST) Sender: are.you.winning@gmail.com Received: by 10.140.239.194 with HTTP; Wed, 5 Nov 2014 09:10:35 -0800 (PST) In-Reply-To: References: Date: Wed, 5 Nov 2014 17:10:35 +0000 X-Google-Sender-Auth: 0-u1q3ol4Ix4rQq66MJ-pRH_i3U Message-ID: Cc: Leigh , Rowan Collins , "internals@lists.php.net" Content-Type: multipart/alternative; boundary=047d7bea3646835bd805071fa880 Subject: Re: [PHP-DEV] [RFC] Additional splat operator usage From: cw@daverandom.com (Chris Wright) --047d7bea3646835bd805071fa880 Content-Type: text/plain; charset=UTF-8 On 5 November 2014 11:43, Chris Wright wrote: > On 5 November 2014 11:22, Leigh wrote: > >> On 4 November 2014 18:14, Rowan Collins wrote: >> > >> > If anything, I think I would expect the keys of splatted arrays to be >> discarded, since it seems most natural to use this in a list context, but I >> can imagine always having to check in the manual. >> >> I agree on this point. Duplicate keys should not overwrite each other. >> >> [...$foo, ...$bar] should literally unpack the values as if they were >> comma delimited and discard all key information. >> >> > Here's how I picture this, which is the rationale for my view on how it > should behave: > > $foo = ['a' => 1, 'b' => 2, 'c' => 3]; > $bar = ['c' => 4, 'd' => 5, 'e' => 6, ...$foo]; > // is identical to writing > $bar = ['a' => 1, 'b' => 2, 'c' => 3, 'c' => 4, 'd' => 5, 'e' => 6]; > > http://3v4l.org/inqtg#v540 > > In other words, in that scenario it's basically syntactic sugar to avoid > having to write out the "body" of the array twice, and would behave > identically as if you had done this. > > Of course, if the majority opinion that this is not the correct approach, > I'm happy to admit I'm wrong :-) > Having performed an extremely unscientific (but I think reasonably fair and unbiased) straw-poll of a few people today, I can tell you that the general expectation of everyone I have spoken to about it is that it would work the same as outlined above. --047d7bea3646835bd805071fa880--