On 25.05.2021 12:40, Karoly Negyesi wrote:
> $array->map($fn1)->filter($fn2)
> 
> 1. It's longer. Much longer.
> 2. It still requires knowing where the array goes. That's legacy which we
> could sidestep with the arrow notation.
> 3. Admittedly, the pipe is much more powerful.

I agree. A unified object oriented interface to arrays (or strings for
that matter) is not a new topic on this list.

I guess you'd have to start with collecting all methods that would need
to be implemented. First stage could be all array_* functions, but I can
imagine others e.g. sorting functions to be included.

> Once again, what I propose here wants to be a simple, cheap to implement,
> narrow quickfix.

I'm afraid it's much more complicated than you think.

> (Although users can add array_foobar($array, $arg1...) for
> $array->foobar($arg1) as they need.)

I wouldn't go that far with this (possible BC break), maybe a future scope.

-- 
Aleksander Machniak
Kolab Groupware Developer        [https://kolab.org]
Roundcube Webmail Developer  [https://roundcube.net]
----------------------------------------------------
PGP: 19359DC1 # Blog: https://kolabian.wordpress.com

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

Reply via email to