Re: [RFC] Pipe Operator, take 2

From: Date: Tue, 08 Jun 2021 01:09:04 +0000
Subject: Re: [RFC] Pipe Operator, take 2
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-114776@lists.php.net to get a copy of this message


> On Jun 7, 2021, at 3:00 PM, Larry Garfield <larry@garfieldtech.com> wrote:
> 
> Hi folks. Me again.
> 
> A year ago, I posted an RFC for a pipe operator, |>, aka function concatenation.  At the
> time, the main thrust of the feedback was "cool, like, but we need partial function application
> first so that the syntax for callables isn't so crappy."
> 
> The PFA RFC is winding down now and is looking quite good, so it's time to revisit pipes.
> 
> https://wiki.php.net/rfc/pipe-operator-v2
> 
> Nothing radical has changed in the proposal since last year.  I have updated it against the
> latest master.  I also updated the RFC to use more examples that assume PFA, as the result is legit
> much nicer.  i also tested it locally with a combined partials-and-pipes branch to make sure they
> play nicely together, and they do.  (Yay!)  Assuming PFA passes I will include those tests in the
> pipes branch before this one goes to a vote.

In general, much nicer with PFA than before.

A few questions though, although #1 is probably best answered by Derick Rethans:

1. Will PHP consider a piped sequence a single expression?  More specifically, will XDEBUG consider
it a single expression, or could XDEBUG be able to set a breakpoint at each pipe assuming they are
on separate lines?  

I ask because if pipes were an indivisible expression from the standpoint of XDEBUG and breakpoints
I would not want to see them included in PHP. Alternately if included in PHP I would avoid using
them like the plague just like I avoid using fluent interfaces because of their inability to be
breakpointed at each step in XDEBUG.


2. Besides throw will there be a way to short-circuit evaluation mid-way through the
pipes without having to write all of the callables to respect said short-circuiting and just return?


For example, could returning an instance of an object that implements a
ShortCircuitPipeInterface allow the pipe to short-circuit, or some other way to
short-circuit and then determine after the pipe if it was short-circuited?

-Mike


Thread (28 messages)

« previous php.internals (#114776) next »