Re: [PHP-DEV] [VOTE] Abstract Syntax Tree

[email protected] (Paul Dragoonis)
Newsgroups php.internals
Message-ID <CAKxcST-AvziEXh_SK70sTFyRinkCEdFMeoUFNNV1m7qofGWgEg@mail.gmail.com>
On Wed, Aug 20, 2014 at 3:41 PM, Levi Morrison <[email protected]> wrote:

> On Wed, Aug 20, 2014 at 7:30 AM, Paul Dragoonis <[email protected]>
> wrote:
> > On Tue, Aug 19, 2014 at 3:32 AM, Andi Gutmans <[email protected]> wrote:
> >
> >> Hi Nikita,
> >>
> >> I reviewed the AST RFC on my way to vote but there was something that
> >> wasn’t clear to me.
> >> This patch introduces some semantic/behavioral changes in addition to
> the
> >> AST.
> >> Are these as a side-effect of how AST was implemented? Or are they
> >> unrelated to the AST patch?
> >> I think some of them make sense but I’m having a bit of a hard time
> >> separating out the benefits of the AST (which I really like) and making
> >> other changes to semantics w/o really understanding if they are
> >> side-effects and we have no choice vs. we’re trying to solve for two
> >> separate items in one RFC.
> >> Any BC breaks here we think could bite us?
> >>
> >
> > Hi Nikita,
> >
> > I second some of Andi's concerns about behavioural changes, some things
> > working from right-to-left and not left-to-right. Are these things that
> we
> > can adapt the AST part or tweak another part to make this more consistent
> > with previous versions of PHP.
>
> I just had a chat with Paul about this, and there was a
> misunderstanding about what this RFC actually does regarding
> left-to-right evaluation on list() constructs. I also saw this
> misunderstanding in a few other places, so it seems to be a common
> misunderstanding.
>
> Under the proposed changes as well as in PHP 5.x, the end result of
> the following is the same:
>
>     list($a, $b) = array(1, 2);
>
> $a will be 1 and $b will be 2. Again, this hasn't changed. The
> difference is that in PHP 5.x the variable $b will be assigned 2
> before $a is assigned 1; under these changes $a will be assigned 1
> first and then $b will be assigned 2.
>

I'm happy with this behaviour and agree that the AST version is what I
would expect, my confusion was that I thought PHP 5.x was 1,2 and the AST
was 2,1 which it of course is not the case. Now you could see why I raised
concerns about this in the first place.


>
> This really only affects strange situations, such as ones listed in the
> RFC.
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.