Yes, certainly this works today. The motivation for Erica&#39;s question is that this would not work without modifying the third-party code if keywords were required to indicate implementation of protocol requirements.<br><br>One possible solution might emerge if it is possible to extend a protocol conditional on Self not being some concrete type. Thus, asking whether there is a way to express that.<br><div class="gmail_quote"><div dir="ltr">On Fri, Apr 29, 2016 at 12:45 Thorsten Seitz &lt;<a href="mailto:tseitz42@icloud.com">tseitz42@icloud.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">No problem, that still works, because the most specific implementation is chosen:<div><br></div><div><div style="margin:0px;font-size:13px;line-height:normal;font-family:Menlo;color:rgb(131,148,150)"></div></div></div><div style="word-wrap:break-word"><div><div style="margin:0px;font-size:13px;line-height:normal;font-family:Menlo;color:rgb(131,148,150)"><div style="margin:0px;line-height:normal"><span style="color:#859901">protocol</span><span> A { </span><span style="color:#859901">func</span><span> foo()}</span></div><div style="margin:0px;line-height:normal;color:rgb(88,110,117)"><span style="color:#859901">protocol</span><span style="color:#839496"> B {} </span><span>// empty protocol</span></div><div style="margin:0px;line-height:normal;min-height:15px"><span></span><br></div></div></div></div><div style="word-wrap:break-word"><div><div style="margin:0px;font-size:13px;line-height:normal;font-family:Menlo;color:rgb(131,148,150)"><div style="margin:0px;line-height:normal;color:rgb(133,153,1)"><span>extension</span><span style="color:#839496"> </span><span style="color:#b58901">A</span><span style="color:#839496">  {</span></div><div style="margin:0px;line-height:normal"><span>    </span><span style="color:#859901">func</span><span> foo() {</span></div><div style="margin:0px;line-height:normal;color:rgb(41,161,152)"><span style="color:#839496">        </span><span style="color:#6c71c4">print</span><span style="color:#839496">(</span><span>&quot;Self is A&quot;</span><span style="color:#839496">)</span></div></div></div></div><div style="word-wrap:break-word"><div><div style="margin:0px;font-size:13px;line-height:normal;font-family:Menlo;color:rgb(131,148,150)"><div style="margin:0px;line-height:normal"><span>    }</span></div><div style="margin:0px;line-height:normal"><span>}</span></div><div style="margin:0px;line-height:normal;min-height:15px"><span></span><br></div><div style="margin:0px;line-height:normal;color:rgb(133,153,1)"><span>extension</span><span style="color:#839496"> </span><span style="color:#b58901">A</span><span style="color:#839496"> </span><span>where</span><span style="color:#839496"> </span><span>Self</span><span style="color:#839496">: B {</span></div><div style="margin:0px;line-height:normal"><span>    </span><span style="color:#859901">func</span><span> foo() {</span></div><div style="margin:0px;line-height:normal;color:rgb(41,161,152)"><span style="color:#839496">        </span><span style="color:#6c71c4">print</span><span style="color:#839496">(</span><span>&quot;Self is B&quot;</span><span style="color:#839496">)</span></div><div style="margin:0px;line-height:normal"><span>    }</span></div><div style="margin:0px;line-height:normal"><span>}</span></div><div style="margin:0px;line-height:normal;min-height:15px"><span></span><br></div><div style="margin:0px;line-height:normal;color:rgb(88,110,117)"><span>// Works</span></div><div style="margin:0px;line-height:normal"><span style="color:#859901">struct</span><span> S1: </span><span style="color:#b58901">A</span><span>, </span><span style="color:#b58901">B</span><span> {}</span></div></div></div></div><div style="word-wrap:break-word"><div><div style="margin:0px;font-size:13px;line-height:normal;font-family:Menlo;color:rgb(131,148,150)"><div style="margin:0px;line-height:normal;color:rgb(88,110,117)"><span style="color:#b58901">S1</span><span style="color:#839496">().</span><span style="color:#6c71c4">foo</span><span style="color:#839496">() </span><span>// Self is B</span></div><div style="margin:0px;line-height:normal;min-height:15px"><span></span><br></div><div style="margin:0px;line-height:normal"><span style="color:#859901">struct</span><span> S2: </span><span style="color:#b58901">A</span><span> {}</span></div><div style="margin:0px;line-height:normal;color:rgb(88,110,117)"><span style="color:#b58901">S2</span><span style="color:#839496">().</span><span style="color:#6c71c4">foo</span><span style="color:#839496">() </span><span>// Self is A</span></div><div style="margin:0px;line-height:normal;min-height:15px"><span></span><br></div><div style="margin:0px;line-height:normal;min-height:15px"><span></span><br></div><div style="margin:0px;line-height:normal;color:rgb(88,110,117)"><span>// Wu&#39;s example works, too</span></div><div style="margin:0px;line-height:normal;min-height:15px"><span></span><br></div><div style="margin:0px;line-height:normal"><span style="color:#859901">struct</span><span> ThirdParty {</span></div><div style="margin:0px;line-height:normal"><span>    </span><span style="color:#859901">func</span><span> foo() {</span></div><div style="margin:0px;line-height:normal;color:rgb(41,161,152)"><span style="color:#839496">        </span><span style="color:#6c71c4">print</span><span style="color:#839496">(</span><span>&quot;Self is ThirdParty&quot;</span><span style="color:#839496">)</span></div><div style="margin:0px;line-height:normal"><span>    }</span></div><div style="margin:0px;line-height:normal"><span>}</span></div><div style="margin:0px;line-height:normal;min-height:15px"><span></span><br></div><div style="margin:0px;line-height:normal;color:rgb(181,137,1)"><span style="color:#859901">extension</span><span style="color:#839496"> </span><span>ThirdParty</span><span style="color:#839496"> : </span><span>A</span><span style="color:#839496"> {}</span></div><div style="margin:0px;line-height:normal;min-height:15px"><span></span><br></div><div style="margin:0px;line-height:normal;color:rgb(88,110,117)"><span style="color:#b58901">ThirdParty</span><span style="color:#839496">().</span><span style="color:#6c71c4">foo</span><span style="color:#839496">() </span><span>// Self is ThirdParty</span></div><div style="margin:0px;line-height:normal;min-height:15px"><span></span><br></div><div style="margin:0px;line-height:normal;min-height:15px"><span></span><br></div><div style="margin:0px;line-height:normal;color:rgb(88,110,117)"><span>// dynamic dispatch works, too</span></div><div style="margin:0px;line-height:normal;min-height:15px"><span></span><br></div><div style="margin:0px;line-height:normal"><span style="color:#859901">let</span><span> a1: </span><span style="color:#b58901">A</span><span> = </span><span style="color:#b58901">S1</span><span>()</span></div><div style="margin:0px;line-height:normal"><span style="color:#d33682">a1</span><span>.</span><span style="color:#6c71c4">foo</span><span>()</span><span> </span><span style="color:rgb(88,110,117)">// Self is B</span></div><div style="margin:0px;line-height:normal;min-height:15px"><span></span><br></div><div style="margin:0px;line-height:normal"><span style="color:#859901">let</span><span> a2: </span><span style="color:#b58901">A</span><span> = </span><span style="color:#b58901">S2</span><span>()</span></div><div style="margin:0px;line-height:normal"><span style="color:#d33682">a2</span><span>.</span><span style="color:#6c71c4">foo</span><span>()</span><span> </span><span style="color:rgb(88,110,117)">// Self is A</span></div><div style="margin:0px;line-height:normal;min-height:15px"><span></span><br></div><div style="margin:0px;line-height:normal;color:rgb(181,137,1)"><span style="color:#859901">let</span><span style="color:#839496"> a3: </span><span>A</span><span style="color:#839496"> = </span><span>ThirdParty</span><span style="color:#839496">()</span><span style="color:rgb(131,148,150)"> </span><span style="color:rgb(88,110,117)">// Self is ThirdParty</span></div><div style="margin:0px;line-height:normal;color:rgb(108,113,196)"><span style="color:#d33682">a3</span><span style="color:#839496">.</span><span>foo</span><span style="color:#839496">()</span></div></div></div></div><div style="word-wrap:break-word"><div><div style="margin:0px;font-size:13px;line-height:normal;font-family:Menlo;color:rgb(88,110,117)"><span><br></span></div><div style="margin:0px;font-size:13px;line-height:normal;font-family:Menlo;color:rgb(88,110,117)"><span><br></span></div><div style="margin:0px;font-size:13px;line-height:normal;font-family:Menlo;color:rgb(88,110,117)"><span style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px">-Thorsten</span></div></div></div><div style="word-wrap:break-word"><div><div style="margin:0px;font-size:13px;line-height:normal;font-family:Menlo;color:rgb(88,110,117)"><span style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px"><br></span></div><div style="margin:0px;font-size:13px;line-height:normal;font-family:Menlo;color:rgb(88,110,117)"><span style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px"><br></span></div><div><blockquote type="cite"><div>Am 29.04.2016 um 17:20 schrieb Erica Sadun &lt;<a href="mailto:erica@ericasadun.com" target="_blank">erica@ericasadun.com</a>&gt;:</div><br><div><div style="word-wrap:break-word"><div>In Wux&#39;s example, he has third party code:</div><div><br></div><div>```</div><div>Type ThirdParty {</div><div>    func foo() { print(&quot;from third party&quot;) }</div><div>}</div><div>```</div><div><br></div><div>Then in his own code, he defines protocol A and extends it:</div><div><br></div><div><div dir="auto"><div><div><div style="margin:0px;font-size:18px;line-height:normal;font-family:Menlo;color:rgb(187,44,162)"><span>extension</span><span> </span><span style="color:rgb(79,129,135)">A</span><span> {</span></div><div style="margin:0px;font-size:18px;line-height:normal;font-family:Menlo"><span>    </span><span style="color:rgb(187,44,162)">func</span><span> foo() {</span></div><div style="margin:0px;font-size:18px;line-height:normal;font-family:Menlo;color:rgb(209,47,27)"><span>        </span><span style="color:rgb(61,29,129)">print</span><span>(</span><span>&quot;Self is B&quot;</span><span>)</span></div><div style="margin:0px;font-size:18px;line-height:normal;font-family:Menlo"><span>    }</span></div><div style="margin:0px;font-size:18px;line-height:normal;font-family:Menlo"><span>}</span></div></div></div></div><br></div><div>and conforms ThirdParty to A. But he wants the original  foo() implementation. Your approach</div><div>for writing an extension for plain A without a where clause doesn&#39;t offer that solution. The goal</div><div>here is &quot;Add this default behavior *only* where a type does not conform to B&quot;</div><div><br></div><div>-- E</div><div><br></div><div><br></div><div><blockquote type="cite"><div>On Apr 29, 2016, at 9:10 AM, Thorsten Seitz &lt;<a href="mailto:tseitz42@icloud.com" target="_blank">tseitz42@icloud.com</a>&gt; wrote:</div><br><div><div dir="auto"><div></div><div>Just writing an extension for plain A without a where clause works.</div><div><br></div><div>-Thorsten </div><div><br>Am 29.04.2016 um 16:03 schrieb Erica Sadun via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;:<br><br></div><blockquote type="cite"><div>Gmane is down as far as my browser is concerned and I haven&#39;t found anything by Googling.<div><br></div><div>Given the following:</div><div><br></div><div><div style="margin:0px;font-size:18px;line-height:normal;font-family:Menlo;color:rgb(187,44,162)"><span>protocol</span><span> A {</span><span>func</span><span> foo()}</span></div><div style="margin:0px;font-size:18px;line-height:normal;font-family:Menlo;color:rgb(0,132,0)"><span style="color:#bb2ca2">protocol</span><span> B {} </span><span>// empty protocol</span></div><div style="margin:0px;font-size:18px;line-height:normal;font-family:Menlo;min-height:21px"><span></span><br></div><div style="margin:0px;font-size:18px;line-height:normal;font-family:Menlo;color:rgb(187,44,162)"><span>extension</span><span> </span><span style="color:#4f8187">A</span><span> </span><span>where</span><span> </span><span>Self</span><span>:B {</span></div><div style="margin:0px;font-size:18px;line-height:normal;font-family:Menlo"><span>    </span><span style="color:#bb2ca2">func</span><span> foo() {</span></div><div style="margin:0px;font-size:18px;line-height:normal;font-family:Menlo;color:rgb(209,47,27)"><span>        </span><span style="color:#3d1d81">print</span><span>(</span><span>&quot;Self is B&quot;</span><span>)</span></div><div style="margin:0px;font-size:18px;line-height:normal;font-family:Menlo"><span>    }</span></div><div style="margin:0px;font-size:18px;line-height:normal;font-family:Menlo"><span>}</span></div><div style="margin:0px;font-size:18px;line-height:normal;font-family:Menlo;min-height:21px"><span></span><br></div><div style="margin:0px;font-size:18px;line-height:normal;font-family:Menlo;color:rgb(0,132,0)"><span>// Works</span></div><div style="margin:0px;font-size:18px;line-height:normal;font-family:Menlo"><span style="color:#bb2ca2">struct</span><span> S1: </span><span style="color:#4f8187">A</span><span>, </span><span style="color:#4f8187">B</span><span> {}</span></div><div style="margin:0px;font-size:18px;line-height:normal;font-family:Menlo"><span style="color:#4f8187">S1</span><span>().</span><span style="color:#31595d">foo</span><span>()</span></div></div><div><span><br></span></div><div><span>Is there a way to produce a similar extension that exempts any type that conforms to B?</span></div><div><span><br></span></div><div><span>cc&#39;ing in Wux because this is a direct response to a scenario he brought up yesterday.</span></div><div><span><br></span></div><div><span>-- E</span></div><div><span><br></span></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" target="_blank">swift-evolution@swift.org</a></span><br><span><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br></div></blockquote></div></div></blockquote></div><br></div></div></blockquote></div><br></div></div></blockquote></div>