Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:78682 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 27888 invoked from network); 4 Nov 2014 20:55:34 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Nov 2014 20:55:34 -0000 Authentication-Results: pb1.pair.com header.from=ajf@ajf.me; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=ajf@ajf.me; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain ajf.me designates 198.187.29.245 as permitted sender) X-PHP-List-Original-Sender: ajf@ajf.me X-Host-Fingerprint: 198.187.29.245 imap11-3.ox.privateemail.com Received: from [198.187.29.245] ([198.187.29.245:36029] helo=imap11-3.ox.privateemail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 61/44-02095-54D39545 for ; Tue, 04 Nov 2014 15:55:33 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.privateemail.com (Postfix) with ESMTP id 7C0F78800F8; Tue, 4 Nov 2014 15:55:30 -0500 (EST) X-Virus-Scanned: Debian amavisd-new at imap11.ox.privateemail.com Received: from mail.privateemail.com ([127.0.0.1]) by localhost (imap11.ox.privateemail.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id LRNYv2IJXI-0; Tue, 4 Nov 2014 15:55:30 -0500 (EST) Received: from oa-edu-170-172.wireless.abdn.ac.uk (oa-edu-170-172.wireless.abdn.ac.uk [137.50.170.172]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.privateemail.com (Postfix) with ESMTPSA id E33718800F5; Tue, 4 Nov 2014 15:55:29 -0500 (EST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 8.0 \(1990.1\)) In-Reply-To: Date: Tue, 4 Nov 2014 20:55:27 +0000 Cc: "internals@lists.php.net" Content-Transfer-Encoding: quoted-printable Message-ID: References: To: Rowan Collins X-Mailer: Apple Mail (2.1990.1) Subject: Re: [PHP-DEV] [RFC] Additional splat operator usage From: ajf@ajf.me (Andrea Faulds) > On 4 Nov 2014, at 18:14, Rowan Collins = wrote: >=20 > On 3 November 2014 22:45:11 GMT, Chris Wright = wrote: >> Good evening list, >>=20 >> I'd like to open discussion a relatively simple and clear-cut RFC, >> either >> people will like it or they won't, there isn't a lot more to say here >> than >> what's in the RFC so please have a read. >>=20 >> https://wiki.php.net/rfc/additional-splat-usage >=20 > I like the concept with list-style arrays, but find the behaviour with = regards associative arrays quite confusing. There's already a difference = in behaviour between array_merge and + in this regard, and having a = third way of writing the same thing isn't great - it would apparently be = legal to write $foobar =3D [...$foo, ...$bar]; to simply merge two = existing arrays. >=20 > 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 don=E2=80=99t think they=E2=80=99d be discarded. The named parameters = RFC proposes that named keys be kept by ..., and I=E2=80=99d prefer we = do that since it makes more sense anyway: [=E2=80=98foo=E2=80=99=3D>=E2=80= =99bar] and [...[=E2=80=99foo=E2=80=99=3D>=E2=80=99bar=E2=80=99]] should = act the same, no? Also, since arrays don=E2=80=99t discard duplicate keys normally, ... = shouldn=E2=80=99t. -- Andrea Faulds http://ajf.me/