<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>I have a change ready and can turn it into a PR. Jordan mentioned in the bug that this would require a SE proposal, but looking at this as a bug in the current implementation rather than a change in the language makes sense. It certainly is trivial enough, and doesn&#39;t change any semantics, so I&#39;ll make a PR today. </div><div><br></div><div>If we do want a proposal to move forward Erica gave me some great language updates that I can address.</div><div><br></div><div>The other bug <a href="https://bugs.swift.org/browse/SR-103">https://bugs.swift.org/browse/SR-103</a> looks like it&#39;s been getting some attention and debate on if it should go through the evolution process. <br></div><div><br></div><div>Brian</div><div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word"></div></blockquote></div><div class="gmail_quote">On Thu, Mar 9, 2017 at 3:23 AM, Slava Pestov <span dir="ltr">&lt;<a href="mailto:spestov@apple.com" target="_blank">spestov@apple.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word">I think the fact that the type checker permits ‘final’ to appear inside protocol extensions is an oversight and this probably does not even warrant a proposal. I don’t think allowing this was ever part of the conceptual model of protocol extensions at any point in time (if you recall they were introduced ‘recently’, in Swift 2). If someone put together a PR which makes ‘final’ in protocol extensions an error in Swift 4 mode (and a warning in 3), I would merge it.</div></blockquote><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word"><div><br></div><div>FWIW that there is one restriction around the direct dispatch here we want to lift, but it’s not related to this proposal.</div><div><br></div><div>If you have a base class conforming to a protocol using default requirements, eg</div><div><br></div><div>  protocol Proto { func f() }</div><div>  extension Proto { func f() { } }</div><div><br></div><div>  class Base : Proto {}</div><div><br></div><div>Currently the witness table for Base : Proto directly references the extension method Proto.f.</div><div><br></div><div>We want to allow this, at least inside the module:</div><div><br></div><div>class Derived {</div><div>  override func f() {} // does not work currently</div><div>}</div><div><br></div><div>This will mean that ‘Proto.f’ will appear in the vtable of ‘Base’, pointing at the extension method. The conformance will dispatch through the vtable instead of directly calling the extension method.</div><div><span class="gmail-HOEnZb"><font color="#888888"><div><br></div></font></span><div><span class="gmail-HOEnZb"><font color="#888888">Slava</font></span><div><br><div><blockquote type="cite"><div><div class="gmail-h5"><div>On Mar 7, 2017, at 7:23 PM, Brian King via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt; wrote:</div><br class="gmail-m_196622832675876083Apple-interchange-newline"></div></div><div><div><div class="gmail-h5"><div dir="ltr"><div style="font-size:12.8px">Hey Folks, <span style="font-size:12.8px">This draft proposal addresses </span><span style="font-size:12.8px">starter bug SR-1762.</span><span style="font-size:12.8px"> I believe this is in scope for Swift 4 since it impacts source compatibility</span><span style="font-size:12.8px">. It&#39;s not a very exciting proposal, but I think it will help make Swift a little more consistent.</span></div><div style="font-size:12.8px"><span style="font-size:12.8px"><br></span></div><div style="font-size:12.8px"><span style="font-size:12.8px"><a href="https://gist.github.com/KingOfBrian/6f20c566114ac0ef54c8092d80e54ee7" target="_blank">https://gist.github.com/<wbr>KingOfBrian/<wbr>6f20c566114ac0ef54c8092d80e54e<wbr>e7</a></span><br></div><div style="font-size:12.8px"><a href="https://bugs.swift.org/browse/SR-1762" target="_blank">https://bugs.swift.org/browse/<wbr>SR-1762</a></div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">Thanks</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">Brian</div><div style="font-size:12.8px"><h2 style="font-family:-apple-system,blinkmacsystemfont,&quot;segoe ui&quot;,helvetica,arial,sans-serif,&quot;apple color emoji&quot;,&quot;segoe ui emoji&quot;,&quot;segoe ui symbol&quot;;box-sizing:border-box;margin-top:24px;margin-bottom:16px;line-height:1.25;padding-bottom:0.3em;border-bottom:1px solid rgb(234,236,239)">Introduction</h2><h2 style="font-family:-apple-system,blinkmacsystemfont,&quot;segoe ui&quot;,helvetica,arial,sans-serif,&quot;apple color emoji&quot;,&quot;segoe ui emoji&quot;,&quot;segoe ui symbol&quot;;box-sizing:border-box;margin-top:24px;margin-bottom:16px;line-height:1.25;padding-bottom:0.3em;border-bottom:1px solid rgb(234,236,239)"><p style="font-size:16px;font-weight:normal;box-sizing:border-box;margin-top:0px;margin-bottom:16px">This proposal suggests removing support for the <code style="box-sizing:border-box;font-family:sfmono-regular,consolas,&quot;liberation mono&quot;,menlo,courier,monospace;font-size:13.6px;padding:0.2em 0px;margin:0px;background-color:rgba(27,31,35,0.0470588);border-radius:3px">final</code> keyword when declaring a function in a protocol extension. The presence of the <code style="box-sizing:border-box;font-family:sfmono-regular,consolas,&quot;liberation mono&quot;,menlo,courier,monospace;font-size:13.6px;padding:0.2em 0px;margin:0px;background-color:rgba(27,31,35,0.0470588);border-radius:3px">final</code> keyword does not currently generate an error message, and it does not actually modify the dispatch behavior in any way.</p></h2><h2 style="font-family:-apple-system,blinkmacsystemfont,&quot;segoe ui&quot;,helvetica,arial,sans-serif,&quot;apple color emoji&quot;,&quot;segoe ui emoji&quot;,&quot;segoe ui symbol&quot;;box-sizing:border-box;margin-top:24px;margin-bottom:16px;line-height:1.25;padding-bottom:0.3em;border-bottom:1px solid rgb(234,236,239)"><a id="gmail-m_196622832675876083gmail-user-content-motivation" class="gmail-m_196622832675876083gmail-anchor" href="https://gist.github.com/KingOfBrian/6f20c566114ac0ef54c8092d80e54ee7#motivation" style="color:rgb(3,102,214);box-sizing:border-box;background-color:transparent;text-decoration:none;float:left;padding-right:4px;line-height:1" target="_blank"></a>Motivation</h2><h2 style="font-family:-apple-system,blinkmacsystemfont,&quot;segoe ui&quot;,helvetica,arial,sans-serif,&quot;apple color emoji&quot;,&quot;segoe ui emoji&quot;,&quot;segoe ui symbol&quot;;box-sizing:border-box;margin-top:24px;margin-bottom:16px;line-height:1.25;padding-bottom:0.3em;border-bottom:1px solid rgb(234,236,239)"><p style="font-size:16px;font-weight:normal;box-sizing:border-box;margin-top:0px;margin-bottom:16px">In the original protocol model of Swift, a developer could use the <code style="box-sizing:border-box;font-family:sfmono-regular,consolas,&quot;liberation mono&quot;,menlo,courier,monospace;font-size:13.6px;padding:0.2em 0px;margin:0px;background-color:rgba(27,31,35,0.0470588);border-radius:3px">final</code> keyword when declaring a function in a protocol extension to ensure the function could not be overridden. This keyword has no use in Swift&#39;s current protocol model, since functions in protocol extensions can not be overridden and will always use direct dispatch.</p></h2><h2 style="font-family:-apple-system,blinkmacsystemfont,&quot;segoe ui&quot;,helvetica,arial,sans-serif,&quot;apple color emoji&quot;,&quot;segoe ui emoji&quot;,&quot;segoe ui symbol&quot;;box-sizing:border-box;margin-top:24px;margin-bottom:16px;line-height:1.25;padding-bottom:0.3em;border-bottom:1px solid rgb(234,236,239)"><a id="gmail-m_196622832675876083gmail-user-content-detailed-design" class="gmail-m_196622832675876083gmail-anchor" href="https://gist.github.com/KingOfBrian/6f20c566114ac0ef54c8092d80e54ee7#detailed-design" style="color:rgb(3,102,214);box-sizing:border-box;background-color:transparent;text-decoration:none;float:left;padding-right:4px;line-height:1" target="_blank"></a>Detailed design</h2><h2 style="font-family:-apple-system,blinkmacsystemfont,&quot;segoe ui&quot;,helvetica,arial,sans-serif,&quot;apple color emoji&quot;,&quot;segoe ui emoji&quot;,&quot;segoe ui symbol&quot;;box-sizing:border-box;margin-top:24px;margin-bottom:16px;line-height:1.25;padding-bottom:0.3em;border-bottom:1px solid rgb(234,236,239)"><p style="font-size:16px;font-weight:normal;box-sizing:border-box;margin-top:0px;margin-bottom:16px">The compiler should generate an error or warning when the <code style="box-sizing:border-box;font-family:sfmono-regular,consolas,&quot;liberation mono&quot;,menlo,courier,monospace;font-size:13.6px;padding:0.2em 0px;margin:0px;background-color:rgba(27,31,35,0.0470588);border-radius:3px">final</code> keyword is used on a function declaration inside of a protocol extension. This is consistent with the use of <code style="box-sizing:border-box;font-family:sfmono-regular,consolas,&quot;liberation mono&quot;,menlo,courier,monospace;font-size:13.6px;padding:0.2em 0px;margin:0px;background-color:rgba(27,31,35,0.0470588);border-radius:3px">final</code> in structs and enumerations.</p></h2><h2 style="font-family:-apple-system,blinkmacsystemfont,&quot;segoe ui&quot;,helvetica,arial,sans-serif,&quot;apple color emoji&quot;,&quot;segoe ui emoji&quot;,&quot;segoe ui symbol&quot;;box-sizing:border-box;margin-top:24px;margin-bottom:16px;line-height:1.25;padding-bottom:0.3em;border-bottom:1px solid rgb(234,236,239)"><a id="gmail-m_196622832675876083gmail-user-content-source-compatibility" class="gmail-m_196622832675876083gmail-anchor" href="https://gist.github.com/KingOfBrian/6f20c566114ac0ef54c8092d80e54ee7#source-compatibility" style="color:rgb(3,102,214);box-sizing:border-box;background-color:transparent;text-decoration:none;float:left;padding-right:4px;line-height:1" target="_blank"></a>Source compatibility</h2><h2 style="font-family:-apple-system,blinkmacsystemfont,&quot;segoe ui&quot;,helvetica,arial,sans-serif,&quot;apple color emoji&quot;,&quot;segoe ui emoji&quot;,&quot;segoe ui symbol&quot;;box-sizing:border-box;margin-top:24px;margin-bottom:16px;line-height:1.25;padding-bottom:0.3em;border-bottom:1px solid rgb(234,236,239)"><p style="font-size:16px;font-weight:normal;box-sizing:border-box;margin-top:0px;margin-bottom:16px">This change will impact source compatibility. To maintain compatibility with Swift 3, a warning will be generated in Swift 3 mode instead of an error message.</p></h2><h2 style="font-family:-apple-system,blinkmacsystemfont,&quot;segoe ui&quot;,helvetica,arial,sans-serif,&quot;apple color emoji&quot;,&quot;segoe ui emoji&quot;,&quot;segoe ui symbol&quot;;box-sizing:border-box;margin-top:24px;margin-bottom:16px;line-height:1.25;padding-bottom:0.3em;border-bottom:1px solid rgb(234,236,239)"><a id="gmail-m_196622832675876083gmail-user-content-effect-on-abi-stability" class="gmail-m_196622832675876083gmail-anchor" href="https://gist.github.com/KingOfBrian/6f20c566114ac0ef54c8092d80e54ee7#effect-on-abi-stability" style="color:rgb(3,102,214);box-sizing:border-box;background-color:transparent;text-decoration:none;float:left;padding-right:4px;line-height:1" target="_blank"></a>Effect on ABI stability</h2><h2 style="font-family:-apple-system,blinkmacsystemfont,&quot;segoe ui&quot;,helvetica,arial,sans-serif,&quot;apple color emoji&quot;,&quot;segoe ui emoji&quot;,&quot;segoe ui symbol&quot;;box-sizing:border-box;margin-top:24px;margin-bottom:16px;line-height:1.25;padding-bottom:0.3em;border-bottom:1px solid rgb(234,236,239)"><p style="font-size:16px;font-weight:normal;box-sizing:border-box;margin-top:0px;margin-bottom:16px">This has no effect on ABI stability</p></h2><h2 style="font-family:-apple-system,blinkmacsystemfont,&quot;segoe ui&quot;,helvetica,arial,sans-serif,&quot;apple color emoji&quot;,&quot;segoe ui emoji&quot;,&quot;segoe ui symbol&quot;;box-sizing:border-box;margin-top:24px;margin-bottom:16px;line-height:1.25;padding-bottom:0.3em;border-bottom:1px solid rgb(234,236,239)"><a id="gmail-m_196622832675876083gmail-user-content-effect-on-api-resilience" class="gmail-m_196622832675876083gmail-anchor" href="https://gist.github.com/KingOfBrian/6f20c566114ac0ef54c8092d80e54ee7#effect-on-api-resilience" style="color:rgb(3,102,214);box-sizing:border-box;background-color:transparent;text-decoration:none;float:left;padding-right:4px;line-height:1" target="_blank"></a>Effect on API resilience</h2><h2 style="font-family:-apple-system,blinkmacsystemfont,&quot;segoe ui&quot;,helvetica,arial,sans-serif,&quot;apple color emoji&quot;,&quot;segoe ui emoji&quot;,&quot;segoe ui symbol&quot;;box-sizing:border-box;margin-top:24px;margin-bottom:16px;line-height:1.25;padding-bottom:0.3em;border-bottom:1px solid rgb(234,236,239)"><p style="font-size:16px;font-weight:normal;box-sizing:border-box;margin-top:0px;margin-bottom:16px">This has no effect on API resilience</p></h2><h2 style="font-family:-apple-system,blinkmacsystemfont,&quot;segoe ui&quot;,helvetica,arial,sans-serif,&quot;apple color emoji&quot;,&quot;segoe ui emoji&quot;,&quot;segoe ui symbol&quot;;box-sizing:border-box;margin-top:24px;margin-bottom:16px;line-height:1.25;padding-bottom:0.3em;border-bottom:1px solid rgb(234,236,239)"><a id="gmail-m_196622832675876083gmail-user-content-alternatives-considered" class="gmail-m_196622832675876083gmail-anchor" href="https://gist.github.com/KingOfBrian/6f20c566114ac0ef54c8092d80e54ee7#alternatives-considered" style="color:rgb(3,102,214);box-sizing:border-box;background-color:transparent;text-decoration:none;float:left;padding-right:4px;line-height:1" target="_blank"></a>Alternatives considered</h2><h2 style="font-family:-apple-system,blinkmacsystemfont,&quot;segoe ui&quot;,helvetica,arial,sans-serif,&quot;apple color emoji&quot;,&quot;segoe ui emoji&quot;,&quot;segoe ui symbol&quot;;box-sizing:border-box;margin-top:24px;margin-bottom:16px;line-height:1.25;padding-bottom:0.3em;border-bottom:1px solid rgb(234,236,239)"><div style="font-size:16px;font-weight:normal;box-sizing:border-box;margin-top:0px;margin-bottom:0px">The only alternative would be to not fix this bug</div></h2></div></div></div></div><span class="gmail-">
______________________________<wbr>_________________<br>swift-evolution mailing list<br><a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank">https://lists.swift.org/<wbr>mailman/listinfo/swift-<wbr>evolution</a><br></span></div></blockquote></div><br></div></div></div></div></blockquote></div><br></div></div>