Re: Bug 63744 - references in list()

From: Date: Thu, 29 Dec 2016 01:32:23 +0000
Subject: Re: Bug 63744 - references in list()
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-97479@lists.php.net to get a copy of this message
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/

« previous php.internals (#97479) next »