Re: 5.4's New De-referencing plus assignment
| From: | Nikita Popov | Date: | Wed, 30 Nov 2011 18:51:46 +0000 |
| Subject: | Re: 5.4's New De-referencing plus assignment | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-56684@lists.php.net to get a copy of this message | ||
Hi Ralph!
This (in it's current form) doesn't look like a good idea to me. You
are only handling yet another edge case. ($foo = $bar = new A)->bar()
would again not work.
If we really want this kind of (expr)-> syntax, then it should really
accept *any* expr. But I am not quite sure whether this will work out
easily because in this case we can't be sue that expr is an object
(but maybe it'll be simple, I just don't know).
Nikita
On Wed, Nov 30, 2011 at 7:09 PM, Ralph Schindler
<ralph@ralphschindler.com> wrote:
> Hey all (Filipe),
>
> This was brought up in the thread "New dereferencing syntaxes in 5.4".
>
> I too think this would be beneficial:
>
> $value = ($obj = new Foo)->produceAValue();
>
> but the current parser (branch 5.4) doesn't have a rule for this. I've
> attached a quick/working patch, but I don't fully understand the
> ramifications of such a patch.
>
> Can someone explain the drawbacks of increasing the "%expect n" for me?
>
> Would this many s/r require/benefit from a new expression grouping?
>
> More to the point, can we have this small change for 5.4?
>
> Thanks in advance.
> -ralph
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php