Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:78717 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 26720 invoked from network); 5 Nov 2014 11:43:12 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Nov 2014 11:43:12 -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.49 as permitted sender) X-PHP-List-Original-Sender: are.you.winning@gmail.com X-Host-Fingerprint: 209.85.216.49 mail-qa0-f49.google.com Received: from [209.85.216.49] ([209.85.216.49:44590] helo=mail-qa0-f49.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 34/A2-10214-E4D0A545 for ; Wed, 05 Nov 2014 06:43:11 -0500 Received: by mail-qa0-f49.google.com with SMTP id i13so321512qae.36 for ; Wed, 05 Nov 2014 03:43:08 -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:to:cc:content-type; bh=ojp7Ihf79wG/Ebgh0j4cidr5NhjSi2z5Xco4ekBO/OM=; b=LEnLAEmG3RASsNay1E0soLBZlRHoOdFSZp2cNkA8vLGaC+FXTx4q8ddv2gXWzgRWMx 1ZZuIAbn9QzEUuJkAAOChXCA9N6WcV3tL0GXx1i/cX6l53+0JxbjyVl8szFcAbacn4gL OkeiPeHV96xmc6XBYXRulgX2LySpBJQGfcnXe3OtBhhu/fiDix9elh0xnInYwMrQfPhx loOuP+bS9zDBHOIGX9ZMh6aTf21t2+uuXMJnOT+s95At8ycW1G8wTpVXJJjC6vtB+l63 14NW6oPT8UtA9Uh9y/0T9EvXJzJQ1hiMz+yMQPpT4lwVfu1D6JUWI6DBO6z2wUDHst3r yHoQ== MIME-Version: 1.0 X-Received: by 10.224.114.79 with SMTP id d15mr84027434qaq.29.1415187788373; Wed, 05 Nov 2014 03:43:08 -0800 (PST) Sender: are.you.winning@gmail.com Received: by 10.140.239.194 with HTTP; Wed, 5 Nov 2014 03:43:08 -0800 (PST) In-Reply-To: References: Date: Wed, 5 Nov 2014 11:43:08 +0000 X-Google-Sender-Auth: 57hliJPNfEe7GQlEYFca80WjiQk Message-ID: To: Leigh Cc: Rowan Collins , "internals@lists.php.net" Content-Type: multipart/alternative; boundary=047d7bea36466aa6bc05071b1577 Subject: Re: [PHP-DEV] [RFC] Additional splat operator usage From: cw@daverandom.com (Chris Wright) --047d7bea36466aa6bc05071b1577 Content-Type: text/plain; charset=UTF-8 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 :-) -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --047d7bea36466aa6bc05071b1577--