Re: [RFC] Pre-draft for PipeOp v2
| From: | Stanislav Malyshev | Date: | Thu, 21 Sep 2017 21:13:14 +0000 |
| Subject: | Re: [RFC] Pre-draft for PipeOp v2 | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-100741@lists.php.net to get a copy of this message | ||
Hi!
> After discussion with Levi and others who suggested a simpler
> approach, I'd like to offer
> https://github.com/php/php-src/compare/master...sgolemon:pipe2
> as an
> alternate possibility.
I am still feeling it is a bit weird to do things that way, but other
than that (which is just my personal issue) I do not see any problems in
this proposal. With magic weird $$ thing gone, it seems to be
straightforward and mostly intuitive. So while I am not feeling this is
a must, I think it may be nice to have it.
It'd be also nice then if we could have some syntax that allowed us to
refer to functions/methods as callables - mostly for the benefit of the
code readers and IDEs. I.e. you can do "hello" |> "strtoupper" and it's
fine but it is not at all intuitive what you're doing sending one string
into another. Same with "hello" |> [$this, 'bar']. Now, if we could do
something like this:
"hello" |> &{strtoupper}
"hello" |> &{$this->bar}
(yes I know the syntax is ugly, I hope you get the idea though to have a
syntax for this) then you could have better readability, easier IDE
autocompletion and other benefits. Not for this RFC, clearly, but just
putting it out there so I don't forget.
--
Stas Malyshev
smalyshev@gmail.com