> On Jun 7, 2021, at 9:39 PM, Larry Garfield <la...@garfieldtech.com> wrote: > > On Mon, Jun 7, 2021, at 8:09 PM, Mike Schinkel wrote: >> >>> On Jun 7, 2021, at 3:00 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. >> >> 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. > > $foo |> bar(?) |> baz(?); > > will produce the same AST as > > baz(bar($foo)); > > So whatever Xdebug can do with that AST, it should still be able to do.
That is unfortunate. Few people write code or would write code like bazoom(baz(bar(foo($x)))) because the trailing parenthesis make it far from ergonomic. What you are proposing therefore is an ergonomic way to convert a program into a single large expression (when taken to the limit.) Given that your pipe RFC makes practical a style of coding that was previously not practical it begs the question of addressing intermediate steps in the AST to support breakpoints, which also might require XDEBUG to introspect the values on the calling stack. Unfortunately I do not know enough about how the internal representations work to argue that this be considered a must; hopefully Derick Rethans will comment on this. -Mike