This feels a bit random, but anyone else feel like...
# stdlib
o
This feels a bit random, but anyone else feel like
.filter { }
could have gotten a better name? Everytime I see
.filter { }
, my brain has to stand still and figure out if it actually means "filter out" or not. I think
.where { }
would have been a more easier name to scan and understand what it does
1
j
Same for
filterNot
e
this happens to me as well
j
There's more value in using standard terms than not
j
What you mean with standard terms?
j
Filter/map/flatMap/fold/reduce etc
2
These are well established terms in functional programming
o
C# LINQ uses .Where, as far as I know
j
I guess it is because it is based on data bases in which
where
is usual
r
Tbh personally, everytime I look/write at LINQ my brain stops and I have to think what to read/use. (for example
x.select { it.attribute }
does not make sense for me) It's more of habit thing. And afaik .NET & databases are only languages using these "declarative" terms. Everything else uses the functional ones.
o
Yes,
.select { }
is worse than
map
i agree, but sure we can take the best of both worlds? (where and map)
🚫 1
z
Nothing is stopping you from just writing your own extension function that does the same right?
☝️ 1
o
You're right, no one is stopping me. But it would be weird when a Kotlin dev would join my codebase and the standard of
.filter
is now
where
, so that's why I would rather use
filter
than
where
as long as
filter
is the standard inside the Kotlin community So I agree with @jw to keep with a standard, but the question is what you refer to as the 'standard', so I am saying that it would be better if the stdl function name changed. But ofcourse it's too late for that now