<div dir="ltr">Right, sorry, I should have clarified. The scenario to be supported here is that the code for structs A, B, and C cannot be modified. They could be part of the stdlib, for example, or a closed-source third-party library.<div><div><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Apr 28, 2016 at 1:18 PM, Matthew Johnson <span dir="ltr">&lt;<a href="mailto:matthew@anandabits.com" target="_blank">matthew@anandabits.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div><br><br>Sent from my iPad</div><span class=""><div><br>On Apr 28, 2016, at 1:09 PM, Erica Sadun via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt; wrote:<br><br></div></span><blockquote type="cite"><div><span class=""><div style="font-family:Palatino-Roman">Sorry, that&#39;s not my question, which doesn&#39;t involve protocols I don&#39;t own. Let me restate. Given three types I don&#39;t own as follows:<br></div><div style="font-family:Palatino-Roman"><br></div><div style="font-family:Palatino-Roman">```</div></span><span class=""><div style="font-family:Palatino-Roman"><div>struct A : Frobnicate {</div><div>    override required func frobnicate() { print(&quot;A&quot;) } // &quot;A&quot;, or delete to get default</div><div>}</div><div>struct B: Frobnicate {</div><div>    override required func frobnicate() { print(&quot;B&quot;) } // &quot;B&quot;, or delete to get default</div><div>}</div><div>struct C: Frobnicate  { }</div></div><div style="font-family:Palatino-Roman">```</div><div style="font-family:Palatino-Roman"><br></div></span></div></blockquote><div>We can&#39;t add the keywords if the structs are defined in a module we import but don&#39;t own.  We are only declaring the conformance retroactively.  The ability to do this is a crucial aspect of generic programming.  It isn&#39;t yet clear how your proposal handles retroactive modeling.</div><span class=""><br><blockquote type="cite"><div><div style="font-family:Palatino-Roman"><div>-- E</div><div><br></div><div><br></div></div><div><blockquote type="cite"><div>On Apr 28, 2016, at 11:48 AM, Xiaodi Wu &lt;<a href="mailto:xiaodi.wu@gmail.com" target="_blank">xiaodi.wu@gmail.com</a>&gt; wrote:</div><br><div><div style="font-family:Palatino-Roman;font-size:14px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">Sorry, that&#39;s not my question, which doesn&#39;t involve protocols I don&#39;t own. Let me restate. Given three types I don&#39;t own as follows:<br></div><div style="font-family:Palatino-Roman;font-size:14px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br></div><div style="font-family:Palatino-Roman;font-size:14px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">```</div><div style="font-family:Palatino-Roman;font-size:14px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div>struct A {</div><div>    func frobnicate() { print(&quot;A&quot;) }</div><div>}</div><div>struct B {</div><div>    func frobnicate() { print(&quot;B&quot;) }</div><div>}</div><div>struct C { }</div></div><div style="font-family:Palatino-Roman;font-size:14px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">```</div><div style="font-family:Palatino-Roman;font-size:14px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br></div><div style="font-family:Palatino-Roman;font-size:14px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">I want to conform them to a protocol of my own design, Frobnicatable, and supply a default `frobnicate()`:</div><div style="font-family:Palatino-Roman;font-size:14px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br></div><div style="font-family:Palatino-Roman;font-size:14px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">```</div><div style="font-family:Palatino-Roman;font-size:14px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div>protocol Frobnicatable {</div><div>    func frobnicate()</div><div>}</div><div>extension Frobnicatable {</div><div>    func frobnicate() { print(&quot;Default&quot;) }</div><div>}</div><div>extension A: Frobnicatable { }</div><div>extension B: Frobnicatable { }</div><div>extension C: Frobnicatable { }</div></div><div style="font-family:Palatino-Roman;font-size:14px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br></div><div style="font-family:Palatino-Roman;font-size:14px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">let c = C()</div><div style="font-family:Palatino-Roman;font-size:14px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">c.frobnicate() // &quot;Default&quot;</div><div style="font-family:Palatino-Roman;font-size:14px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">```</div><div style="font-family:Palatino-Roman;font-size:14px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br></div><div style="font-family:Palatino-Roman;font-size:14px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div>(Yes, I realize there are issues regarding static and dynamic dispatch that limit the utility of this particular example--let&#39;s leave those aside for now.)</div><div>Where would I affix keywords such as `required` and `override` to make this work after implementation of your proposal?</div></div></div></blockquote></div><br></div></blockquote></span><span class=""><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></span></div></blockquote></div><br></div></div></div></div>