<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=""><br class=""><div><blockquote type="cite" class=""><div class="">On May 3, 2017, at 2:09 AM, Brent Royal-Gordon 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=""><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 May 3, 2017, at 12:25 AM, Xiaodi Wu 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=""><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 definitely agree that it's a feature that _can_ be used unwisely, but the fact remains that it _is_ used pervasively in the standard library, and deliberately</span></div></blockquote></div><div class=""><br class=""></div><div class="">I'm not so sure that's true. Which standard library protocols intentionally depend upon certain parts to not be overridable? Are they so pervasive that we wouldn't prefer to just mark those members that need it with a `final` keyword? If John McCall woke up tomorrow with some genius idea of how to make extension methods overridable with zero overhead, would we choose to keep the current design? </div></div></div></blockquote><div><br class=""></div><div>Extension methods are not explicitly part of the protocol requirements, so having them overridable by default based on a type having a method or property with a matching signature is basically duck typing.</div><div><br class=""></div><div>A hypothetical example, but if swift didn't define "filter(_)" as part of Sequence, it might mean that an extension adds filter with the predicate indicating that the value is included, while my custom sequence defined a filter method where true from the predicate means the value should be 'filtered out'. Both methods would wind up having identical signatures. Generic algorithms written under the concept that 'filter', added by an extension, is now part of the 'Sequence' contract, would be quite confused that sometimes the behavior of their algorithm reverses.</div><div><br class=""></div>That method implementations which are not part of the protocol definition define functionality around use of a protocol rather than extending the protocol requirements can be confusing, but to me it has always seemed correct. To have those methods be part of the protocol requirements is changing the protocol requirements.</div><div><br class=""></div><div>I tried pitching a proposal a few months ago which attempted not to change the rules but to have the code declare intent and compiler warn if the declared intent seemed wrong. I was surprised it got very little interest. Right now, we have an issue where overriding a class method gives you a nice error if you fat-finger part of the signature, but implementing a protocol with extensions providing default implementations does nothing (either when declaring the protocol extension or implementing the protocol within your type)</div><div><br class=""></div><div>-DW</div></body></html>