Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:97490 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 54174 invoked from network); 29 Dec 2016 22:49:31 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 29 Dec 2016 22:49:31 -0000 X-Host-Fingerprint: 24.9.232.76 c-24-9-232-76.hsd1.co.comcast.net Received: from [24.9.232.76] ([24.9.232.76:26237] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id DE/77-04761-6F295685 for ; Thu, 29 Dec 2016 17:49:29 -0500 Message-ID: To: internals@lists.php.net References: Date: Thu, 29 Dec 2016 15:49:23 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Posted-By: 24.9.232.76 Subject: Re: Bug 63744 - references in list() From: dave@mudsite.com (David Walker) On 12/28/16 6:32 PM, Andrea Faulds wrote: > 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! > The listserve has been acting weird lately. Your message didn't end up sending to me; I keep tallies of things via news.php.net :-/ Hope it fixes itself sometime soon. Anywho I did some work on the feature plugging it in, I hadn't looked at your previous attempt so I can see if anything there would be applicable in 7. https://github.com/bp1222/php-src/commit/dc1e126b7b0e2fa225919d4151365da5248d4400 My one-hour implementation doesn't seem to be leaking like your example had, however, recursive lists aren't working. I'd believe that there's other cases I'm probably not thinking of that would need supporting as well, but it's getting closer. I'll keep hitting at an implementation and spin up that RFC sometime soon then. -- Dave