Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:69295 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 5741 invoked from network); 23 Sep 2013 19:45:53 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 Sep 2013 19:45:53 -0000 Authentication-Results: pb1.pair.com smtp.mail=ajf@ajf.me; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ajf@ajf.me; sender-id=pass Received-SPF: pass (pb1.pair.com: domain ajf.me designates 192.64.116.197 as permitted sender) X-PHP-List-Original-Sender: ajf@ajf.me X-Host-Fingerprint: 192.64.116.197 imap3-2.ox.registrar-servers.com Received: from [192.64.116.197] ([192.64.116.197:32819] helo=imap3-2.ox.registrar-servers.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 81/53-25349-07A90425 for ; Mon, 23 Sep 2013 15:45:53 -0400 Received: from localhost (localhost [127.0.0.1]) by oxmail.registrar-servers.com (Postfix) with ESMTP id A06E02A006F for ; Mon, 23 Sep 2013 15:45:49 -0400 (EDT) X-Virus-Scanned: Debian amavisd-new at imap3.ox.registrar-servers.com Received: from oxmail.registrar-servers.com ([127.0.0.1]) by localhost (imap3.ox.registrar-servers.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id yJQ8Ercby1BS for ; Mon, 23 Sep 2013 15:45:49 -0400 (EDT) Received: from [192.168.0.200] (unknown [94.10.74.149]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by oxmail.registrar-servers.com (Postfix) with ESMTPSA id 462352A0053 for ; Mon, 23 Sep 2013 15:45:49 -0400 (EDT) Message-ID: <52409A4D.3070404@ajf.me> Date: Mon, 23 Sep 2013 20:45:17 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.0 MIME-Version: 1.0 To: internals@lists.php.net References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Argument unpacking - Multiple unpacks and trailing arguments From: ajf@ajf.me (Andrea Faulds) On 23/09/2013 20:33, Nikita Popov wrote: > The main open question (or at least the focus of the discussion) seems to > be whether to allow multiple unpacks and trailing arguments. > I'm not sure I like the idea of multiple unpacks, were we to implement named parameters (if you did f(...(['a' => 2]), ...(['a' => 3])) you'd presumably have the $a argument overridden?), but I can't oppose it for linear arguments alone. I'm not sure about trailing arguments either. I'm not sure if there's really a good use case for them. I notice that we do not allow either in the variadics RFC, so I think it would make sense to be consistent with that. If someone really needs to do either of these, it would be a simple array_merge() away, and that might make the code clearer. I also note that Python doesn't allow either of these. I can't find why exactly, but I would assume there were good reasons behind it. So I think it would be best to allow neither of those, for the sake of consistency. (OT: I've also just discovered that Python supports "a, b, *c = someseq" for multiple assignment, perhaps we could see "list($a, $b, ...$c) = $someseq" support?) -- Andrea Faulds http://ajf.me/