Re: [RFC] Pipe Operator, take 2
| From: | Larry Garfield | Date: | Mon, 28 Jun 2021 20:12:37 +0000 |
| Subject: | Re: [RFC] Pipe Operator, take 2 | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-115192@lists.php.net to get a copy of this message | ||
On Mon, Jun 28, 2021, at 3:04 PM, Rowan Tommins wrote:
> On 28/06/2021 20:25, Olle Härstedt wrote:
> > Usage (ignoring the pesky undefined constant warnings ><):
>
>
> Unfortunately, you can't ignore those warnings; not least because
> they're fatal errors in PHP 8, as they frankly should have been in PHP 3.
>
> You can use our current ugly callable syntax (strings and two-element
> arrays); you can tackle the complexity of unifying functions with
> constants, and methods with properties (as Levi explained in the other
> thread); or you can add a dedicated callable syntax, which the PFA
> proposal gets us with bells on.
>
> Regards,
I think that's a pretty good summary. There's nothing that pipes or partials do that you
couldn't emulate in user-space today (really, since 5.3 is you really wanted to). The
emulation is just butt-ugly and slower, which is why most people don't do it except in very
specific cases or if they have a user-space library available that makes it slightly less butt-ugly.
The purpose of PFA and pipes (and short functions, and auto-capture closures, and basically
everything else I've been talking about all year) is to make those things prettier and as fast
as reasonable, which makes using those techniques more natural. Once you start down that path,
though, there's really no usable solution before you get down as far as... PFA and Pipes in
their current form.
--Larry Garfield