Re: [Vote] Pipe operator

From: Date: Tue, 13 May 2025 19:34:57 +0000
Subject: Re: [Vote] Pipe operator
References: 1 2  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
On Tue, May 13, 2025, at 1:41 PM, Levi Morrison wrote:
> On Mon, May 12, 2025 at 8:00 PM Larry Garfield <[email protected]> wrote:
>>
>> I hereby open the vote on the Pipe operator RFC:
>>
>> https://wiki.php.net/rfc/pipe-operator-v3
>>
>> The vote will run until 26 May.
>
> Hey, Larry, quick check:
>
>> Supporting pass-by-ref parameters in simple cases is quite easy, and
>> a naive implementation would support it. However, passing a value
>> from a compound value (an object property or array element) by
>> reference does not work, and throws an “Argument could not be passed
>> by reference” error. In practice, it is easier to forbid pass-by-ref
>> parameters in pipe than to allow them.
>
> Is this a restriction that can be lifted in a future version? I agree
> that it's unlikely to be useful, but if the $temp = chain version
> supports it, then so too I would expect a pipeline to be able to
> handle it.

Lifting it on simple variables (strings, ints, etc.) is quite simple.  It actually took effort (not
much) to make those not work, so that could just be undone in like 2 lines.  References to compound
variables, I don't know how to make work.  It might be possible for someone with more engine-fu
for me to figure that out, I don't know.  But since IMO one shouldn't be using references
in a pipe chain anyway, I didn't invest much time in figuring out how to do so.

--Larry Garfield


Thread (8 messages)

« previous php.internals (#127346) next »