Re: [PHP-DEV] [RFC] Pipe Assignment Operator
[email protected] (Caleb White) Tue, 14 Jul 2026 11:37:26 +0000
| Newsgroups | php.internals |
|---|---|
| Message-ID | <3493Q4k-QMhsW95VQUDf_SzZx94MEWtd0HnwRkBhcBsHLUDAjQMPBWKgc6PvRQ0Nym4zzBlqNzdTMgFxS27m29YZbIIuiYu8Woi9JspfCwA=@pm.me> |
On Tuesday, July 14th, 2026 at 03:22, Tim Düsterhus <[email protected]> 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