Re: Pipe Operator v2
| From: | Stefan Neufeind | Date: | Thu, 21 Jul 2016 05:59:59 +0000 |
| Subject: | Re: Pipe Operator v2 | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-94606@lists.php.net to get a copy of this message | ||
On 21.07.2016 06:37, Sara Golemon wrote:
> On Wed, Jul 20, 2016 at 8:50 PM, Larry Garfield <larry@garfieldtech.com> wrote:
[...]
> return $this->loadConfig()
> |> $arg->useConfig($$)
> |> $this->loadUser($$)
> |> array_merge($$, $this->userDefaults);
>
> But the PSR7 example is already contrived as it is.
>
>> This other recent discussion/proposal for a "Cascade" operator seems like it
>> would handle the OOP/method case much better:
>>
>> http://news.php.net/php.internals/94466
>>
>> Note: I am not suggesting one is a substitute for the other; rather, that
>> they are complementary by addressing different parts of the problem space,
>> and the Pipe RFC should likely not emphasize OOP usage potential as I see
>> not a great deal there. I am still in favor of it, but let's not over-state
>> its use cases.
>>
> Fair enough. They certainly complement one another and I wouldn't
> argue either is a one-job-fits-all solution.
[...]
Hi,
Would joining the two be an option?
If $$ is in the parameter-list, use that as the position for the
parameter. If not, use the parameter as first argument?
Kind regards,
Stefan