-
Notifications
You must be signed in to change notification settings - Fork 17.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
proposal: slices: add AllMatch #68532
Comments
AnyMatch is just slices.ContainsFunc. And why a third time with SomeMatch? |
yes, you're right. we can omit it or add it as an alias for the |
I don't see how a new or alias API improves readability. Adding new API defragments writing and worsens readability by having more inconsistent code. Surely writability is improved. But readability is more important in the long term. |
@seankhliao , could you please explain why did you change the title? |
I agree with this, but I didn't get why the alias will reduce readability? As for me, it's the same as reading AnyMatch and ContainsFunc, the first one is even better, because it's intuitive and clear(the ContaintFunc sounds like "Does it contains func") |
We're not going to add aliases to existing functions, plus there is an expected format for titles. |
thank you! |
Both are aliases of ContainsFunc. |
More possibilities for writers means more mental load for readers. An alias is not much but it adds up over the years. Look at the evolution of other languages and how many writing possibilities they have. Ultimately, writers have many opportunities on the shoulders of readers. As a reader it costs to have in mind "Ah, x is the same as y.". |
Rather than having specific functions in slices, these seem more appropriate for the proposal x/exp/xiters package. See, for example, #67453. |
This proposal suggests adding three new methods,
AllMatch
, to theslices
package. The method will provide developers with powerful and concise ways to perform common operations on slices, enhancing code readability and reducing the likelihood of errors.I look forward to feedback from the maintainers and the community on this proposal and I'm ready to implement it if you don't mind.
The text was updated successfully, but these errors were encountered: