Re: [RFC] Pipe Operator (again)
| From: | Larry Garfield | Date: | Sat, 08 Feb 2025 04:05:34 +0000 |
| Subject: | Re: [RFC] Pipe Operator (again) | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-126347@lists.php.net to get a copy of this message | ||
On Fri, Feb 7, 2025, at 5:47 PM, Christoph M. Becker wrote:
> On 07.02.2025 at 23:54, Rob Landers wrote:
>
>> Put another way, what is the order of operations for this new operator?
>>
>> For example, what is the output of
>>
>> $x ? $y |> strlen(…) : $z
>>
>> $x + $y |> sqrt(…) . EOL
>>
>> Etc.
>
> According to the reference implementation[1], that would be equivalent to
>
> $x ? ($y |> strlen(…)) : $z
>
> ($x + $y) |> (sqrt(…) . EOL)
>
>> I noticed this seems to be missing from the RFC. As a new operator, I think it should be
>> important to specify that.
>
> Indeed, precendence and associativity need to be mentioned in the RFC.
>
> [1] <https://github.com/php/php-src/pull/17118>
>
> Christoph
I've added a precedence section, using examples from the tests and this thread.
--Larry Garfield