Hi, Larry, That's super! I hope it will pass! Oladoyinbo, IMO the way it is described right now (e.g. explicit closures) is much more elegant than a new way of doing things that's not so obvious and will be necessary to keep in mind and support anyway.
If it'd be necessary to simplify the stuff, like passing particular parameter from the input pipe into the function at the particular position, - I think it would be possible to do it with partial function application I hope to see in the future. (e.g. bind callback for array_map function, making a new function for the pipe that will accept the only parameter - input array) Thank you On Fri, Feb 7, 2025, 9:16 AM Oladoyinbo Vincent <oladoyin...@gmail.com> wrote: > PHP codebase in general is quite unreadable due to robust way of doing > things. Pipe operator might make things more complicated even more... > > But after reading the RFC, something came to my mind, a way to simplify > this stuff > > What if we implement it this way: > > ```php > > $pipe = " hello world " > |> strtoupper(self) > |> trim(self, ' ') > |> htmlentities(self) > |> fn (self): string => .... > > ``` > > Maybe 'self' or '$this' can be used as the keyword param. > > It's a suggestion anyways. > > On Fri, 7 Feb 2025, 5:58 am Larry Garfield, <la...@garfieldtech.com> > wrote: > >> Hi folks. A few years ago I posted an RFC for a pipe operator, as seen >> in many other languages. At the time it didn't pass, in no small part >> because the implementation was a bit shaky and it was right before freeze. >> Nonetheless, there are now even more (bad) user-space implementations in >> the wild, as it gets brought up frequently in "what do you want in PHP?" >> threads (though nowhere near generics or better async, of course), so it >> seems clear there is demand in the market for it. >> >> It is now back with a better implementation (many thanks to Ilija for his >> help and guidance in that), and it's nowhere close to freeze, so here we go >> again: >> >> https://wiki.php.net/rfc/pipe-operator-v3 >> >> Of particular note, since the last RFC I have concluded that a compose >> operator is a necessary complement to a pipe operator. However, it's also >> going to be notably more work, and the two operators don't actually >> interact at all at the code level, so since people keep saying "Small >> RFCs!", here's a small RFC. :-) >> >> -- >> Larry Garfield >> la...@garfieldtech.com >> >