On Thu, Jan 19, 2017 at 5:54 AM, Levi Morrison <le...@php.net> wrote:
> On Wed, Jul 20, 2016 at 5:42 PM, Sara Golemon <poll...@php.net> wrote: > > With the branching of 7.1, and after some reflection on the previous > > feedback, I'd like to reopen discussion of the Pipe Operator RFC > > https://wiki.php.net/rfc/pipe-operator which I had previously put on > > hold. I've changed much of the argument wording of the proposal, but > > not the substantive feature set. If you still feel it's unworkable, > > I'd like to encourage you to respond with what you think would make it > > workable (if anything). Thanks. > > > > -Sara > > > > -- > > PHP Internals - PHP Runtime Development Mailing List > > To unsubscribe, visit: http://www.php.net/unsub.php > > I've talked to you about this RFC off-list, but I figured I should > mention it on-list as well. I think we should make `|>` and `$$` two > independent operators that work well together (rather than only > together). > > The `|>` symbol would be the piping operator with these semantics: > > 1. Evaluate the left-hand side. > 2. Evaluate the right-hand side. Assert that the result is callable. > 3. Pass the result from 1. as the single argument to 2. > > When you say assert the right hand side is callable, does that mean to call an object method, you would do [$obj, 'method']? What about functions, is it just the name like $str |> trim, or is it $str |> trim()? Neither makes sense to me in the context of PHP since methods/functions are named objects, which is why when you pass a callback you have to give the string name of the function instead of just the name of the function, IE array_filter($arr, 'trim') vs array_filter($arr, trim).