On Mon, Jun 7, 2021, at 4:00 PM, Eugene Leonovich wrote:
> On Mon, Jun 7, 2021 at 9:03 PM Larry Garfield <la...@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.
> >
> >
> FTR, there are several typos in the "Hello World" examples (*strto*t*upper,
> htmlent*i*ties*). Also, these examples will not work as written because
> explode() expects two arguments and will fail if you pass only one:
> https://3v4l.org/tLO0s. I wonder what the correct version of the pipe
> example (the one that uses strings as callbacks) would look like, given
> that you have to pass two arguments for explode()?

Hm.  You're right.  It used to, but it's been a very long time since explode() 
allowed an empty split, apparently.  I updated the example to use str_split, 
which is what I'd intended to do in this case.  Thanks.

If you wanted to explode with a separator in a non-PFA pipes world, you'd need 
to wrap it in an arrow function.  (Hence why a PFA-world pipe is all around 
better.)

--Larry Garfield

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to