Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:83358 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 34020 invoked from network); 20 Feb 2015 22:50:09 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Feb 2015 22:50:09 -0000 Authentication-Results: pb1.pair.com header.from=inefedor@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=inefedor@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.215.53 as permitted sender) X-PHP-List-Original-Sender: inefedor@gmail.com X-Host-Fingerprint: 209.85.215.53 mail-la0-f53.google.com Received: from [209.85.215.53] ([209.85.215.53:37487] helo=mail-la0-f53.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 63/63-14173-02AB7E45 for ; Fri, 20 Feb 2015 17:50:09 -0500 Received: by labpn19 with SMTP id pn19so9096463lab.4 for ; Fri, 20 Feb 2015 14:50:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=content-type:to:date:subject:mime-version:content-transfer-encoding :from:message-id:user-agent; bh=Seiom5Mapc4jxISBlu0NylVln5Pu0qQdt+z+ILwMPGc=; b=vPOnKdU+IKiTtt9K6tFRL3oPNDbfV/LTEl91smztD309M9eHu5/3lbqWyV9O0pdE83 U/velmxxvGKBPy+12ZzbxvraBAvIEFgHxrlYbzpaYHXaPywGJGEVF3l24AXUsuSjTc+i NLjn0dVavsX//89iYHBPSGGHEcGpmNeSt/42lMJNjbjd3TaI+BS23zIoArZyqUTU5iHw bZy8dtT1O/GPI1zghGzlyiuu7n9OvLVkd0ykerZnOAqCDiqD/iinw3yfu5HG6X51n2B4 Y2jQhAF+obGzuMCVxvGMl8CQKfRx5/RLlEKcKT952j+ieEiQRaMwdEzGy5ktp9JsnFBO 0tOA== X-Received: by 10.152.6.66 with SMTP id y2mr10411542lay.25.1424472253091; Fri, 20 Feb 2015 14:44:13 -0800 (PST) Received: from nikita-hp-elitebook-750-g1 ([89.250.5.98]) by mx.google.com with ESMTPSA id nb1sm5758828lbb.18.2015.02.20.14.44.11 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 20 Feb 2015 14:44:11 -0800 (PST) Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes To: "internals@lists.php.net" Date: Sat, 21 Feb 2015 01:43:02 +0400 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Message-ID: User-Agent: Opera Mail/12.16 (Linux) Subject: Allow to use argument unpacking at any place in arguments list From: inefedor@gmail.com ("Niktia Nefedov") Hey folks, Currently argument unpacking can only be used once in a call and only after all positional arguments were passed. E.g. func(1, 2, 3, ...[4, 5]) is allowed, but func(...[1, 2, 3], 4, ...[5]) is not. This makes it impossible to use this feature with some of the ext/std functions (array_udiff, array_interect_ukey, etc.) and just feels a bit incomplete... I would like to propose to allow usage of argument unpacking at any place in arguments you are passing. The patch is pretty simple, you look at it here: https://github.com/nikita2206/php-src/compare/master...unpack-mid-argument-list I still haven't tested performance on the real life apps, but all the synthetic benchmarks (incl. deep recursion in order to let call stack go over the cpu cache) show that there's no difference between this patch and master. Callgrind shows that there is a small increase in the number of instructions ran, which is expected but seems as to be negligible. (It's about 0.5% increase for recursion benchmark). I'm not sure if this change requires an RFC because this is a pretty small, advancement of already existing feature that doesn't contain any BC breaks. So I would be happy if this could go forward without it, but if people disagree here I will make an RFC, that's not a problem (although I would need some karma...)