Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:97479 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 88196 invoked from network); 29 Dec 2016 01:32:28 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 29 Dec 2016 01:32:28 -0000 X-Host-Fingerprint: 94.0.141.221 unknown Received: from [94.0.141.221] ([94.0.141.221:25613] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id AD/F1-04761-AA764685 for ; Wed, 28 Dec 2016 20:32:27 -0500 Message-ID: To: internals@lists.php.net References: Date: Thu, 29 Dec 2016 01:32:23 +0000 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:43.0) Gecko/20100101 Firefox/43.0 SeaMonkey/2.40 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Posted-By: 94.0.141.221 Subject: Re: Bug 63744 - references in list() From: ajf@ajf.me (Andrea Faulds) Hi Dave, David Walker wrote: > I stumbled upon this bug report (read: feature request) today and took a > swing at it thinking it couldn't be that overly complex. But then again it > was requested way back in the PHP4 era, so I figured there has to be some > reason why it hasn't been done before. Be it complex in cases I'm not > thinking of, or, has been deemed something the language doesn't want to > support. > > I was able to, pretty quickly, get a bunch of test cases seemingly > working. Both list-assign from an array container, and that of an object > implementing arrayaccess. > > I'd imagine a change of this kind would probably warrant an RFC, but before > writing it out, and fleshing out the change I just wanted to check if there > were any reasons behind it not being done. I'd wanted to implement this myself before, but PHP 5.x's compilation process made this apparently impossible, and I gave up. There was some issue with the order opcodes were emitted which prevented me making it produce write fetches, IIRC. It was more than three years ago, though, so I can't remmeber the specifics. I had written an RFC for the feature, which I withdrew because of my troubles implementing it: https colon slash slash wiki dot php dot net slash rfc slash list_reference_assignment (sorry for spelling it out, the mail server's being funny right now) But PHP 7.0 switched to an AST-based compilation process where we can compile things in whatever order we like. So this should be simple to implement now. If you want to, please revive my RFC. There's no need to copy it, you just add yourself as an author and reopen it. The RFC could benefit from having a changelog added, so the history of it is clear. One new consideration is that we have a language specification now, so you'd also need a patch for that. If you need any help from me, please ask. Thanks! -- Andrea Faulds https://ajf.me/