-
Notifications
You must be signed in to change notification settings - Fork 21
Rename subtractAll to removeAll #10939
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
Comments
FTR we also have a In the case of |
In So I don't think we should try to unify this any further or change the names. But I would consider past tense names. Or go the other way around and abandon the new past tense names entirely? They are not used consistently and with standard names such as |
I looked through the immutable collections for other naming inconsistencies:
With the inconsistent use of past tense in general there's no strong case for any of them. At least there are no inconsistencies in related methods in immutable collections (e.g. we have some I'll reschedule this for RC1 to take another look but for now I'll keep the bikeshed closed and not open a PR to rename anything. |
I think we talked about this at some point but cannot find the past discussion. IRC, the conclusion was that in-place operations should be named |
This means we'd have to rename all the mutating method, so on I think we have to make a distinction between methods that transform a collection and those that modify an existing collection. The difference is that a transformation runs all elements of the collection through some function which determines the result. This includes methods such as On the other hand we have methods that modify an existing collection, usually by adding or removing a single element or a number of elements, or by updating individual elements by index or key. Except for basic concatenation they are not shared between mutable and immutable collections. The "natural" names feel right for mutable collections (like Based on these rules |
Removing blocker label and adding docs. All the renames that should be done have been merged but the naming rules should find their way into the official docs. |
Hi Everyone, |
This issue, like other issues on the 3.x milestone, isn't currently eligible to progress, because we can't break bidirectional binary compatibility of the Scala standard library in Scala 2 ever again, and even in Scala 3 the timing of next bincompat break isn't determined yet. see scala/scala-dev#661 for background |
In the 2.13 collection library, if you want to delete multiple elements from a mutable collection, the operation is called
subtractAll
. Injava.util.Collections
, it is calledremoveAll
. I propose to renamesubtractAll
toremoveAll
.The name
removeAll
is currently used inimmutable.Map
to define an operation that creates a new collection by removing all elements of another. To me it looks very similar to thediff
operation. Can we reuse this name? Or usesubtractAll
maybe?The text was updated successfully, but these errors were encountered: