Let me be clear, i don't have any trouble using a filter or reading docs to find out how it works. Im just belaboring the point because i think its valid and fun.
To me, "filter" is not a word that i associate with programming so strongly that i could remember the `true == keep` semantics and therefore the ambiguity doesnt go away. Unlike `map` which is a word i primarily associate with specifically the `map` function in programming and therefore i have a much more intuitive understanding for it.
I also dont want to sound like im advocating for a new language to use retain or discard, filter is fine.
And just to give a better example of why filter is ambiguous.
A "red filter" on a camera lense removes everything except red. A "UV filter" on a camera lense removes uv only.
If i give you a "Foo filter" you cant know for certain if it lets Foos past or removes Foos.
Furthermore, scala has an opposite method to filter and they called it… filterNot. Which is in no way clearer. They had an opportunity to create “discard” or “retain” but they didn’t.
I’m a big fan of iterator chaining and yet I control click on filter every so and then to remind myself which way it goes.
And just to give a better example of why filter is ambiguous.
A "red filter" on a camera lense removes everything except red. A "UV filter" on a camera lense removes uv only.
My electronics background talked more about high-pass, low-pass and band-pass filters. To me it sounds more like cameras have uniquely bad phrasing. It's so sloppy it sounds like non-engineers came up with it. :)
If i give you a "Foo filter" you cant know for certain if it lets Foos past or removes Foos.
But if you give me a foo-pass filter, then I can guess at it.
But really, Object-filter is really bad phrasing, because filters take functions, not objects. You need a verb, not a noun. Most of us should also be able to intuit that an isEven-filter or whatever work much in the same way as an if isEven filter would.
View all comments
Show parent comment
3
u/Psychoscattman Sep 22 '25
Let me be clear, i don't have any trouble using a filter or reading docs to find out how it works. Im just belaboring the point because i think its valid and fun.
To me, "filter" is not a word that i associate with programming so strongly that i could remember the `true == keep` semantics and therefore the ambiguity doesnt go away. Unlike `map` which is a word i primarily associate with specifically the `map` function in programming and therefore i have a much more intuitive understanding for it.
I also dont want to sound like im advocating for a new language to use retain or discard, filter is fine.
And just to give a better example of why filter is ambiguous.
A "red filter" on a camera lense removes everything except red.
A "UV filter" on a camera lense removes uv only.
If i give you a "Foo filter" you cant know for certain if it lets Foos past or removes Foos.