Well, if we're going to bikeshed:<br><br>I think removeAll(3) reads fine, while removeAll(of: 3) does not. I do not think that reads right at all--what is "all of three"? Do we mean to contrast it to "some of three"--like, maybe, two of three?<br><br>By comparison, index(of: 3) works because the element equal to three has a corresponding index. However, neither the element equal to three, nor three itself, has a corresponding "allness."<br><br>Put another way, "of" is not a preposition that can substitute for "equal to." This becomes obvious if you consider that, while removeAll(equalTo:) makes perfect sense, index(equalTo:) is not an appropriate alternative (aesthetically pleasing or not) name for index(of:). If verbosity were not an issue, the full names might be:<br><br>removeAllElements(equalTo:)<br>index(ofFirstElementEqualTo:)<br><br>From these hypothetical forms (I'm not suggesting we rename!), one can see how "of" does not really fit with the sense of "removeAll" proposed here.<br><br>Finally--if it's to be called "removeAll" and we want to use the word "contains" for the equatable version, it would be more consistent to call it "containsAll" and not "containsOnly".<br><div class="gmail_quote"><div dir="ltr">On Sun, Apr 9, 2017 at 21:32 Ben Cohen <<a href="mailto:ben_cohen@apple.com">ben_cohen@apple.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class="gmail_msg"><div class="gmail_msg"><blockquote type="cite" class="gmail_msg"><div class="gmail_msg">On Apr 8, 2017, at 5:41 PM, Brent Royal-Gordon <<a href="mailto:brent@architechies.com" class="gmail_msg" target="_blank">brent@architechies.com</a>> wrote:</div><br class="m_8210011677568985270Apple-interchange-newline gmail_msg"><div class="gmail_msg"><div style="word-wrap:break-word" class="gmail_msg"><div class="gmail_msg"><blockquote type="cite" class="gmail_msg"><div class="gmail_msg">On Apr 8, 2017, at 12:44 PM, Xiaodi Wu via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="gmail_msg" target="_blank">swift-evolution@swift.org</a>> wrote:</div><br class="m_8210011677568985270Apple-interchange-newline gmail_msg"><div class="gmail_msg"><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important" class="gmail_msg">+1. Perfect. Let's not bikeshed this and get it done!</span></div></blockquote></div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">Sorry, I'm going to have to insist on bikeshedding.</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">`equalTo:` is kind of ugly and has no precedent in the standard library. Similar APIs seem to either leave the parameter unlabeled or use `of:` (as in `index(of:)`). I think unlabeled is probably the right answer here.</div><div class="gmail_msg"><br class="gmail_msg"></div></div></div></blockquote><div class="gmail_msg"><br class="gmail_msg"></div></div></div><div style="word-wrap:break-word" class="gmail_msg"><div class="gmail_msg"><div class="gmail_msg">I think removeAll(of:) works well for the equatable value version.</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">FWIW of all the ideas from the all thread, containsOnly(_:) for the equatable value version works for me. It has a nice symmetry: contains(3) vs containsOnly(3).</div></div></div><div style="word-wrap:break-word" class="gmail_msg"><div class="gmail_msg"><br class="gmail_msg"><blockquote type="cite" class="gmail_msg"><div class="gmail_msg"><div style="word-wrap:break-word" class="gmail_msg"><div class="gmail_msg">The main shortcoming I can see is that if you see:</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg"><span class="m_8210011677568985270Apple-tab-span gmail_msg" style="white-space:pre-wrap">        </span>array.removeAll(3)</div><div class="gmail_msg"><br class="gmail_msg"></div></div></div></blockquote><div class="gmail_msg"><br class="gmail_msg"></div></div></div><div style="word-wrap:break-word" class="gmail_msg"><div class="gmail_msg"><div class="gmail_msg">Personally don’t feel good about an unlabelled version. It doesn’t read right. Remove all three what?</div></div></div><div style="word-wrap:break-word" class="gmail_msg"><div class="gmail_msg"><br class="gmail_msg"><blockquote type="cite" class="gmail_msg"><div class="gmail_msg"><div style="word-wrap:break-word" class="gmail_msg"><div class="gmail_msg">You might think `3` is either an index or a count. But neither of those actually make sense:</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">* It can't be an index because then `All` would have no meaning. There's only ever one thing at a given index. Besides, indices are almost always marked with `at:` or another parameter label.</div><div class="gmail_msg">* It can't be a count because `All` is already a count. What could "remove all 3" possibly mean if the array doesn't happen to have three elements?</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">And this is only a problem if the value happens to be an integer. If it's anything else, the type makes clear that this can't possibly be an index or count; it must be an element.</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">(But if you really do think this is insurmountable, `removeAll(of: 3)` *is* impossible to misinterpret and fits in better than `removeAll(equalTo:)`.)</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">(P.S. The existing oddness of `removeFirst(_:)` compared to `removeFirst()` and `removeAll()` is why I proposed last year that it be renamed to `removePrefix(_:)`, which matches the count-taking `prefix(_:)` method.)</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">
<span class="m_8210011677568985270Apple-style-span gmail_msg" style="border-collapse:separate;font-variant-ligatures:normal;font-variant-east-asian:normal;line-height:normal;border-spacing:0px"><div class="gmail_msg"><div style="font-size:12px" class="gmail_msg">-- </div><div style="font-size:12px" class="gmail_msg">Brent Royal-Gordon</div><div style="font-size:12px" class="gmail_msg">Architechies</div></div></span>
</div>
<br class="gmail_msg"></div></div></blockquote></div></div></blockquote></div>