On Mon, Jul 17, 2023, at 2:57 PM, Olle Härstedt wrote:
> 2023-07-17 14:25 GMT+02:00, Karoly Negyesi <kar...@negyesi.net>:
>> Hi,
>>
>> I tried to read on why the pipe RFC failed but by and large I also failed.
>>
>> The discussion on https://github.com/php/php-src/pull/7214 is very short.
>>
>> https://externals.io/message/114770 is not so short but it seems not to
>> cover the latest version which uses first class functions?
>>
>> Could someone please give me a summary why it failed? I really would like
>> to see it succeed :) I am writing code if not daily but certainly weekly
>> that certainly looks like a pipeline.
>
> The pipe RFC was kinda forced in before a deadline, no?
>
> My own two cents:
>
> * It's trivial to implement a pipe() function or a Pipe class
> * A Pipe class is better than both a function and built-in operator,
> since it can be configured with custom behaviour, e.g. stop or throw
> on empty payload, or repeat on a collection, or even with parallelism
> or concurrency
> * If I had voting rights, I'd vote in favor in a pipe operator :)

>From my recollection, there were a couple of things involved.

1. It was intended to pair with the PFA RFC, which didn't pass, which made it a 
bit less compelling.
2. It was close to the RFC deadline, and it seems people get squeamish around 
that.
3. Some folks wanted Hack-style pipes instead of the pipes used by every other 
language with pipes. I've written before on why that's a worse design.
4. Arguments that it can be done in user space, which is not true, as I have a 
user-space implementation and it's comparatively cumbersome and definitely 
slower than a native operator would be.
5. General "meh" attitude on FP features in general from some people.

Side note to Olle: If you want a customizable pipe, you've just described a 
Monad. :-)  It's literally "contextually-sensitive func concatenation."  A 
monadic bind operator would be harder to do with PHP's weaker type system, but 
there are ways it could be done.

I'd like to bring the Pipes RFC back if I thought there was a reasonable 
potential for it to pass this time.  I would use the crap out of it myself.  
Though I've also since decided that we do need a straight up func concat 
operator as well.  (I previously thought one would be sufficient, but in 
practice I think we do want both.)

--Larry Garfield

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to