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
Consider using other name for Option.filter #263
Comments
👋 Yeah some names aren't straight forward and are chosen because of their resemblance to their list counterparts.
Actually filter does filter, but it filters for the predicate value. Think of it like filtering for the thing you want. A coffee filter, filters for coffee (the liquid) and filters out anything else (the grounds). Personally I find That being said, I won't remove As far as an alias, where does pop up and people familiar with LINQ/SQL would be more comfortable. I would be open to a PR adding |
Thank you for a very good clarification. I agree with all of that, and indeed |
TaskSeq has a where for every filter, aligning with FSharp's general stance (even though for me it's a bit of a wart, and not an overall positive to have Though the coffee rationale finally gives me a way to make peace with the |
Is your feature request related to a problem? Please describe.
Option.filter
meaning is not clear as it typically resides in collection modules and here we only operate on a single value. And when I understood it what it does and started using it , I had the same problem while presenting the code to my peers. They don't understand it too at a first glance.Additionally filter even with collections provides confusion, as what indeed it does is filtering OUT item(s)
Describe the solution you'd like
A better word for that function. First in mind is 'accept' but it is very subjective too.
Describe alternatives you've considered
but I thing adding another name for 3rd party lib is not perfect
Additional context
Downsides of the proposition: When filter is replaced it is a breaking change, when it is left with another name for the same purpose it brings confusion.
The text was updated successfully, but these errors were encountered: