<div dir="ltr">Thats the thing, I believe it does matter where the super implementation is called from so the developer can reasonably reason as to what behaviour they are invoking by calling &#39;super&#39;. Because of this I&#39;m not 100% convinced that this is the right way to go, even if on face value it seems like the logical way to do it. It&#39;s only when digging in that it becomes apparent that there could be issues in moving this direction.<div><br></div><div>I&#39;m starting to wonder if there is a third option here, something that still explicitly defines that you are taking control over the implementation of the protocol required method implementation but without taking the &#39;override&#39; keyword and making it do something that it&#39;s not originally intended to do (primarily used for overriding methods in the parent class).</div><div><br></div><div>I would quite like a few other people to join in on this discussion so we can get a few minds at work (not that I don&#39;t value you opinion Nevin, I really do, just think the more minds the better) on this problem as it is a legitimate one that I would quite like to see solved by the time Swift 4 rolls around. Any takers?</div><div><br></div><div>Dale</div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 14, 2017 at 11:55 AM, Dale Buckley <span dir="ltr">&lt;<a href="mailto:dalebuckley86@gmail.com" target="_blank">dalebuckley86@gmail.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="ltr">So having a little more of a think about this what should happen in this situation:<div><br></div><div><div>class A {</div><div>    func method() {</div><div>        print(&quot;A&quot;)</div><div>    }</div><div>}</div><div><br></div><div>protocol P {</div><div>    func method()</div><div>}</div><div><br></div><div>extension P {</div><div>    func method() {</div><div>        print(&quot;P&quot;)</div><div>    }</div><div>}</div><div><br></div><div>class B: A, P {</div><div>    override func method() {</div><div>        super.method()</div><div>        print(&quot;B&quot;)</div><div>    }</div><div>}</div><div><br></div><div>B().method()</div></div><div><br></div><div>When &#39;super&#39; is called by the method in class B, should it call the method in class A or the protocol extension in extension P? As it stands by using override it always looks to it&#39;s superclass and ignores what happens in the protocol extension. This says to me that the &#39;override&#39; keyword isn&#39;t right for solving this issue and should be reserved for inheritance, and not for solving this issue with choosing the subclass implementation over the protocol extension implementation.</div><span class="HOEnZb"><font color="#888888"><div><br></div><div>Dale</div></font></span></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 14, 2017 at 11:39 AM, Dale Buckley <span dir="ltr">&lt;<a href="mailto:dalebuckley86@gmail.com" target="_blank">dalebuckley86@gmail.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="ltr">So I did consider using the &#39;override&#39; keyword, but it then raised the question as to what should happen when &#39;super&#39; is called.<div><br></div><div>I agree that by adding &#39;override&#39; it makes it more obvious that you are overriding an existing implementation of the method, regardless of if it&#39;s defined in the class you are inheriting from or from the protocol extension. But if you add &#39;override&#39; you are explicitly saying you can call the super implementation.</div><div><br></div><div>So the question is what should happen here? Realistically you could expect calling &#39;super&#39; would call the protocol extension implementation of the method, but I&#39;m trying to think of the problems that could occur if its implemented in that way.</div><div><br></div><div>Any thoughts on this?</div><span class="m_-497095082689730192HOEnZb"><font color="#888888"><div><br></div><div>Dale</div></font></span></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>