Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:69858 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 75086 invoked from network); 24 Oct 2013 22:14:27 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Oct 2013 22:14:27 -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.241 as permitted sender) X-PHP-List-Original-Sender: ajf@ajf.me X-Host-Fingerprint: 198.187.29.241 imap3-1.ox.registrar-servers.com Received: from [198.187.29.241] ([198.187.29.241:39066] helo=imap3-1.ox.registrar-servers.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A7/43-10840-3CB99625 for ; Thu, 24 Oct 2013 18:14:27 -0400 Received: from localhost (localhost [127.0.0.1]) by oxmail.registrar-servers.com (Postfix) with ESMTP id DDEB52A007B for ; Thu, 24 Oct 2013 18:14:24 -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 LWh-2Til3tir for ; Thu, 24 Oct 2013 18:14:24 -0400 (EDT) Received: from [192.168.0.200] (unknown [94.3.245.95]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by oxmail.registrar-servers.com (Postfix) with ESMTPSA id 6F9DC2A006F for ; Thu, 24 Oct 2013 18:14:24 -0400 (EDT) Message-ID: <52699BBD.5030407@ajf.me> Date: Thu, 24 Oct 2013 23:14:21 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64; rv:25.0) Gecko/20100101 Thunderbird/25.0 MIME-Version: 1.0 To: PHP internals Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: [RFC] list() Reference Assignment From: ajf@ajf.me (Andrea Faulds) Good evening again, Previously I wrote to this mailing list about my proposal to add reference assignment to list() with a new syntax ("[PHP-DEV] Proposal: Implement FR #7930 (list() constructor reference assignment)"). I have now opened an RFC: https://wiki.php.net/rfc/list_reference_assignment In brief, this allows you to write this: $array = [1, 2]; $a = $array[0]; $b = &$array[1]; Like this instead: $array = [1, 2]; list($a, &$b) = $array; Reference assignments with list() work just like normal assignments, and you can still skip variables, use nested list()s, and use list() in foreach as usual. There is a patch with a passing test, however a memory leak bug was found (thanks Nikita!), and so the patch can't be considered complete or final yet. I'm something of a novice at debugging PHP code at the moment, so any help fixing that would be appreciated, but I will try to fix it when I have more time. The patch is here: https://bugs.php.net/bug.php?id=6768 The RFC has been added to the list in Under Discussion. Any thoughts, suggestions, etc. appreciated. Regards, -- Andrea Faulds http://ajf.me/