On Sun, Jul 4, 2021, at 2:18 AM, Olle Härstedt wrote: > 2021-07-04 4:12 GMT+02:00, Larry Garfield <la...@garfieldtech.com>: > > On Mon, Jun 7, 2021, at 2:00 PM, Larry Garfield 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. > > > > Hi again. > > > > With PFA being declined, I've again reworked the Pipes RFC. > > > > 1) It now does not use PFA in any examples, but it does use Nikita's > > first-class-callables RFC that looks like it's going to pass easily. > > > > 2) With major hand-holding from Levi Morrison and Joe Watkins, the > > implementation has shifted a bit. It now evaluates left-to-right, always, > > whereas the previous version evaluated right-to-left. That is, instead of > > $a |> $b |> $c desugaring into $c($b($a)), it now becomes effectively $tmp = > > $a; $tmp = $b($tmp); $tmp = $c($tmp); That matters if $b or $c are function > > calls that return a callable, as they are then only called when the pipeline > > gets to that part of the expression. > > Hi! Can you flesh out an example for this, please? Not sure I get the > use-case where it matters. Couldn't find any example inside the PR > either (the tests) that show-cased this particular implementation > detail. Did I miss it?
The "evaluation order" test is for exactly that: https://github.com/php/php-src/pull/7214/files#diff-526802c5ee7e0aa37afd67683d2c8b73c923b445737b3b44fae6bb5ea117ee97 With the old desugaring way, _test2() was called first before anything else. With the new way, it's called after _test1(), as most people would expect from reading it. --Larry Garfield -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php