Hi all,
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.
--
Dave
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/
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