<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div><blockquote type="cite" class=""><div class="">On Apr 27, 2017, at 11:27 AM, Ben Cohen &lt;<a href="mailto:ben_cohen@apple.com" class="">ben_cohen@apple.com</a>&gt; wrote:</div><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class=""><blockquote type="cite" class=""><div class="">On Apr 26, 2017, at 9:12 PM, John McCall 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=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div class=""><blockquote type="cite" class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><div class=""><div dir="auto" class=""><div class=""><div class=""><span class="" style="background-color: rgba(255, 255, 255, 0);"><br class="Apple-interchange-newline">Is that a mistake? Wouldn't the free function forward to the added method?</span></div></div></div></div></blockquote><div 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;" class=""><br class=""></div><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="">I'm not sure why this is there. &nbsp;The implementation of the method is not part of the library specification. &nbsp;If it forwards to the free function for some reason, it'll be via internal implementation details that certainly don't need to be described in this proposal.</span></div></div></div></blockquote></div><br class=""><div class="">It was there purely to explain why it was necessary to add an otherwise seemingly pointless method to MutableCollection. Needed because of&nbsp;<a href="https://bugs.swift.org/browse/SR-4660" class="">https://bugs.swift.org/browse/SR-4660</a>&nbsp;– in short, if you have a method on self, you cannot call the free function of the same name without full qualification, even if argument labels or different types make it clear which one was intended. So adding swap(_:with:) to MutableCollection would break code currently calling swap(&amp;a,&amp;b), which would need to change to Swift.swap(&amp;a,&amp;b). So we would have to put in an&nbsp;<i class="">extra</i>&nbsp;swap method on MutableCollection, that in turn calls Swift.swap, for source compatibility reasons.</div></div></div></blockquote><div><br class=""></div>Oh, right, that. &nbsp;I had forgotten about that, sorry. :)</div><div><br class=""></div><div>John.</div><div><br class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class=""><br class=""></div><div class="">However, if we adopt the preferred base name swapAt instead, this won’t be necessary.</div><div class=""><br class=""></div><div class="">(it will be necessary to add similar workarounds for min and max to String when it becomes a Collection, though...)</div><div class=""><br class=""></div><div class=""><br class=""></div></div></div></blockquote></div><br class=""></body></html>