<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">+1. We better make sure `equalTo:` is consistent with the label in the `Sequence.all` proposal.<div class=""><br class=""></div><div class="">-Richard<br class=""><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Apr 8, 2017, at 19:41, Brent Royal-Gordon via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=us-ascii" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><blockquote type="cite" class=""><div class="">On Apr 8, 2017, at 12:44 PM, Xiaodi Wu via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><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; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">+1. Perfect. Let's not bikeshed this and get it done!</span></div></blockquote></div><div class=""><br class=""></div><div class="">Sorry, I'm going to have to insist on bikeshedding.</div><div class=""><br class=""></div><div class="">`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=""><br class=""></div><div class="">The main shortcoming I can see is that if you see:</div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>array.removeAll(3)</div><div class=""><br class=""></div><div class="">You might think `3` is either an index or a count. But neither of those actually make sense:</div><div class=""><br class=""></div><div class="">* 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="">* 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=""><br class=""></div><div class="">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=""><br class=""></div><div class="">(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=""><br class=""></div><div class="">(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=""><br class=""></div><div class="">
<span class="Apple-style-span" style="border-collapse: separate; font-variant-ligatures: normal; font-variant-east-asian: normal; font-variant-position: normal; line-height: normal; border-spacing: 0px;"><div class=""><div style="font-size: 12px; " class="">--&nbsp;</div><div style="font-size: 12px; " class="">Brent Royal-Gordon</div><div style="font-size: 12px; " class="">Architechies</div></div></span>

</div>
<br class=""></div>_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></blockquote></div><br class=""></div></div></body></html>