Re: [RFC] Pipe Assignment Operator
| From: | Caleb White | Date: | Tue, 14 Jul 2026 11:37:26 +0000 |
| Subject: | Re: [RFC] Pipe Assignment Operator | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-131916@lists.php.net to get a copy of this message | ||
On Tuesday, July 14th, 2026 at 03:22, Tim Düsterhus <tim@bastelstu.be> wrote:
> Thank you. One note regarding “the lowest precedence level,
> right-associative”. This is not quite correct. While the assignment
> operators have fairly low precedence, they are not the lowest. As an
> example, the infamous
$foo = bar() or die() pattern relies on
> or
> having a lower precedence than assignment. This should be corrected.
>
> The $result = ($x |>= double(...)) |> triple(...);
> example also
> doesn't showcase precedence, because of the explicit parentheses.
Ah, yes. I meant among the symbolic operators but you are correct and I've
updated to make this more clear. I removed the explicit parentheses from the
example.
> Looking at the RFC examples again, I was reminded of this RFC:
> https://wiki.php.net/rfc/implicit_move_optimisation, which
> concerns
> itself with optimizing the $foo = func($foo); case. Perhaps it
> makes
> sense to list this in the references section, because with
> |>= this
> “in-place” reassignment would become an official pattern.
I've added this to the references and discussed it in the Future Scope
section.
Best,
Caleb