<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><br><br><div id="AppleMailSignature">Sent from my iPhone</div><div><br>On 15 Jun 2017, at 05:41, Paul Cantrell via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>&gt; wrote:<br><br></div><blockquote type="cite"><div><meta http-equiv="Content-Type" content="text/html charset=utf-8"><br class=""><div><blockquote type="cite" class=""><div class="">On Jun 14, 2017, at 4:51 PM, David Hart 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=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On 14 Jun 2017, at 22:37, Vladimir.S 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="">On 14.06.2017 21:23, Haravikk via swift-evolution wrote:<br class=""><blockquote type="cite" class=""><blockquote type="cite" class="">On 14 Jun 2017, at 19:08, Xiaodi Wu via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a> &lt;<a href="mailto:swift-evolution@swift.org" class="">mailto:swift-evolution@swift.org</a>&gt;&gt; wrote:<br class=""><br class="">On Wed, Jun 14, 2017 at 1:01 PM, David Hart via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a> &lt;<a href="mailto:swift-evolution@swift.org" class="">mailto:swift-evolution@swift.org</a>&gt;&gt; wrote:<br class=""><br class=""> &nbsp;&nbsp;&nbsp;Sorry, initially sent off-list:<br class=""><br class=""> &nbsp;&nbsp;&nbsp;I think this proposal is a great idea. But I would vote for the alternative of<br class=""> &nbsp;&nbsp;&nbsp;only having default and implicitly deducing extend when default is not specified:<br class=""><br class=""><br class="">This wouldn't work with the fundamental design decision that these are optional keywords, which IMO is absolutely key.<br class=""></blockquote></blockquote></div></div></blockquote></div></div></div></blockquote><blockquote type="cite" class=""><blockquote type="cite" class=""><br class=""></blockquote></blockquote><blockquote type="cite" class=""><div 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=""><div class=""><blockquote type="cite" class="">Hmm, I'm inclined to agree with David that only the default keyword really seems like it's necessary, and that extend can be implied.<br class=""></blockquote>…</div></div></blockquote><div class=""><br class=""></div><div class="">I think a good plan would be to make default required in a later Swift version (Swift 5) for example, and only warn for now.</div></div></div></div></blockquote><div><br class=""></div><div>I like only having “default,” and I like David’s plan for achieving that.</div></div><br class=""><div class="">• • •</div><div class=""><br class=""></div><div class="">It seems that this proposal could help mitigate the problems described in the classic “Ghost of Swift Bugs Future” (<a href="https://nomothetis.svbtle.com/the-ghost-of-swift-bugs-future" class="">https://nomothetis.svbtle.com/the-ghost-of-swift-bugs-future</a>). There’s a nice new convention (I think?) of:</div><div class=""><br class=""></div><div class="">`extend` / no modifier in extension → static dispatch</div><div class="">`default` &nbsp;in extension → dynamic dispatch</div><div class=""><br class=""></div><div class="">(Does this always hold in an extensions?)</div><div class=""><br class=""></div><div class="">Knowing whether the extension’s author •intended• static or dynamic dispatch could also allow the compiler to give better warnings: about shadowing at declaration sites, and also also potentially at call sites where multiple extension methods could match depending on the compile-time type of the receiver.</div></div></blockquote><div><br></div><div>+10000</div><div><br></div><div>To me static dispatch is an optimisation over dynamic one, but it should only be applied when it cannot introduce side effects or when the programmer is asking for it explicitly: code path execution should never change no matter how we are casting a reference (base type or subclass) and users should know if they are implementing a method that will never be called as it shadows a default method only declared in a protocol extension.</div><div><br></div><div>Thanks for reminding the list of this article:&nbsp;<font color="#000000" style="background-color: rgba(255, 255, 255, 0);"><a href="https://nomothetis.svbtle.com/the-ghost-of-swift-bugs-future" class="" style="background-color: rgba(255, 255, 255, 0);">https://nomothetis.svbtle.com/the-ghost-of-swift-bugs-future</a>&nbsp;</font></div><div><br></div><div>These problems should be addressed.</div><br><blockquote type="cite"><div><div class=""><br class=""></div><div class="">Might it be worth describing some of these warnings out in the proposal? I realize warnings don’t require full swift-evo treatment, but it would be nice to at least sketch out in the “Impact on Existing Code” section what the warnings might look like.</div><div class=""><br class=""></div><div class="">Cheers,</div><div class=""><br class=""></div><div class="">Paul</div><div class=""><br class=""></div></div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>swift-evolution mailing list</span><br><span><a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a></span><br><span><a href="https://lists.swift.org/mailman/listinfo/swift-evolution">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br></div></blockquote></body></html>