Re: [VOTE] PHP\iterable\any() and all() on iterables
| From: | Kamil Tekiela | Date: | Tue, 09 Feb 2021 00:37:42 +0000 |
| Subject: | Re: [VOTE] PHP\iterable\any() and all() on iterables | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-113121@lists.php.net to get a copy of this message | ||
Hi Tyson,
Thanks for the RFC. I have to say that I like the core concept and the
motivation behind it. However, let me explain why I voted No.
1. As others have said I think that the scope is too small. If we are going
to create that namespace then I would like to see more functions/classes in
that namespace.
2. I don't like the name. I know the namespace might provide some guidance
of what the function is, but namespaces are often imported. What we are
left with in the code is then
any()/all() that doesn't have a
self-describing name. any_values is better but still doesn't describe the
action that the function will take. I am a strong believer that methods and
functions should be called with verbs which describe an action. e.g.
search, filter, combine, merge, etc. There can always be exceptions but
there should be a good reason to justify such an exception.
3. I am unclear about the implementation itself. There aren't that many
clear examples in the RFC. For example, I don't understand why the second
parameter is nullable and optional. How is it different from array_filter?
4. Please, no more loose checks. I don't want to have the same trouble as
with in_array().
Kind Regards,
Kamil