Re: Pipe Operator v2
| From: | Ryan Pallas | Date: | Thu, 19 Jan 2017 23:55:29 +0000 |
| Subject: | Re: Pipe Operator v2 | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-97886@lists.php.net to get a copy of this message | ||
On Thu, Jan 19, 2017 at 4:08 PM, Rowan Collins <rowan.collins@gmail.com>
wrote:
>
>
> On 19/01/2017 22:17, Ryan Pallas wrote:
>
>>
>> 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()?
>>
>
> This is a good point. The difference between the pipe operator as proposed
> by Sara and the combination of two separate operators is that in Sara's
> proposal you'd always write this:
>
> $str |> trim($$)
>
> But in Levi's proposal as I understand it, the right-hand side is not
> syntax, it's just constrained to be callable, so the simpler (but rather
> ugly) form would be:
>
> $str |> 'trim'
>
See I don't like that at all, I hate having to put functions/methods in
strings, as find usages and refactor tools generally don't find the
strings. But sometimes I have to yield my preference to those who outrank
me (aka those with voting power)