<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Apr 26, 2017, at 9:12 PM, John McCall via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> 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. The implementation of the method is not part of the library specification. 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 <a href="https://bugs.swift.org/browse/SR-4660" class="">https://bugs.swift.org/browse/SR-4660</a> – 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(&a,&b), which would need to change to Swift.swap(&a,&b). So we would have to put in an <i class="">extra</i> swap method on MutableCollection, that in turn calls Swift.swap, for source compatibility reasons.</div><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></body></html>