On Thu, Aug 11, 2022, at 1:51 PM, Alex Wells wrote:

> The pipe operator RFC has actually been mentioned before; the short 
> takeway is: pipe operator works and has a benefit of using existing 
> functions. The downside is that those are still functions, not methods, 
> meaning you’ll still be left with `[your_type]_` prefixes for all 
> function names, unlike extension methods, where you can have multiple 
> methods with the same name (for different types).

This is incorrect, and has been since functions could be namespaced.  Please 
stop repeating this, it is FUD.

Also, "existing functions" is also not quite accurate.  PIpe worked with any 
callable; the Partial Function Application RFC was intended to make turning 
arbitrary functions into callables, which could then be easily piped, but you 
can also use arbitrary callables, including closures and objects that implement 
__invoke().  array_map in its current form wouldn't be pipeable anyway as it 
requires multiple arguments, but higher order functions that are pipe-friendly 
as trivial to write.  (See previous message for a link to many.)

--Larry Garfield

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

Reply via email to