<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>Calling super asynchronously would not meet an @requires_super specification IMO. &nbsp;I would interpret it to mean you must call super before returning.</div><div id="AppleMailSignature"><br></div><div id="AppleMailSignature">The compiler already guarantees all code paths return and guarantees subclass initializers call super. &nbsp;I don't think a sensible definition of&nbsp;<span style="background-color: rgba(255, 255, 255, 0);">@requires_super would be any more complex than that.&nbsp;</span></div><div id="AppleMailSignature"><br>Sent from my iPad</div><div><br>On Dec 16, 2015, at 11:49 AM, Marc Knaup &lt;<a href="mailto:marc@knaup.koeln">marc@knaup.koeln</a>&gt; wrote:<br><br></div><blockquote type="cite"><div><div dir="ltr">Sounds reasonable since even the best flow analysis cannot ensure that all codepaths call the super&nbsp;implementation.<div><br></div><div>Some more edge cases:</div><div><ul><li>Calling super asynchronously by using it in a closure</li><li>Referring to the super implementation by assign it to a variable and call it later (is that really possible? never did that)</li></ul></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Dec 16, 2015 at 6:25 PM, Vester Gottfried <span dir="ltr">&lt;<a href="mailto:vester.gottfried@gmail.com" target="_blank">vester.gottfried@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">I would suggest that @requires_super only checks if a call to super is present at all. More detailed behaviour should be part of the functions documentation, because I think all possibilities cannot be checked easily by the compiler. For example a call to super my be required to happen early or late inside the function. But when too early or too late is can probably not been forseen by the compiler.</div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Dec 16, 2015 at 5:46 PM, Marc Knaup <span dir="ltr">&lt;<a href="mailto:marc@knaup.koeln" target="_blank">marc@knaup.koeln</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">+1 always had such issues with UIViewController's lifecycle methods.<div><br></div><div>But edge cases need to be considered like "throws" for example.</div><div>Do I need to call super before I throw something?</div></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Dec 16, 2015 at 5:41 PM, Matthew Johnson via swift-evolution <span dir="ltr">&lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">+1 to this.&nbsp; Anything that helps ensure inheritance is thought through carefully and used correctly is a win.<div><br><div><blockquote type="cite"><div><div><div>On Dec 16, 2015, at 10:32 AM, Vester Gottfried via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt; wrote:</div><br></div></div><div><div><div><div dir="ltr"><div>Some class based libraries/frameworks expect the consumer to subclass certain classes and override specific method and require that the super implementation of an overridden method is being called.</div><div><br></div><div>Not calling the super implementation is a common source of bugs that may be prevented if the compiler checks if super is called, like it does in some cases of init().</div><div><br></div><div>Example:<br></div><div><br></div><div>class Box {</div><div>&nbsp; &nbsp;@requires_super<br></div><div>&nbsp; &nbsp; func addStuff() { ... }</div><div>}<br></div><div><br></div><div>Overriding class&nbsp;Box's addStuff without calling super.addStuff() should result in an error</div><div><br></div><div>class Chest :&nbsp;Box {</div><div>&nbsp; &nbsp; override addStuff() {<br></div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// ERROR: addStuff() requires call to super.addStuff()</div><div>&nbsp; &nbsp; &nbsp; &nbsp; ...</div><div>&nbsp; &nbsp; }</div><div>}<br></div><div><br></div><div>Objective-C developers know this as NS_REQUIRES_SUPER and I think its worth thinking about adapting it.</div><div><div><br></div><div>I hope my proposal was clear and thanks for reading,</div><div><br></div></div><div>Gottfried</div></div>
</div></div><img src="https://u2002410.ct.sendgrid.net/wf/open?upn=eLFMrKDT8iBxZ-2Fbnk-2BZqvSchNN-2FvYXdceA0T7VxwkAfetdXVtelgzCfab-2Fp92fvLNUbxvC5Ukh9mTRYtT7oZ-2BzUDHQ-2FkLVfwWHuXGWvz7iaXCPo1KAcjPGxoZUQTW8DMleErzJnIt-2FRMb1-2FEM1WN-2BscY0xmKk-2BmXO16SS-2BCT9-2B7dgbk1nlmgpvH5cNha2dTvKe3-2FSntENn88F21K4ayGJlZuPediCmd1qI2SGJLz5ZQ-3D" alt="" width="1" height="1" border="0" style="min-height:1px!important;width:1px!important;border-width:0!important;margin-top:0!important;margin-bottom:0!important;margin-right:0!important;margin-left:0!important;padding-top:0!important;padding-bottom:0!important;padding-right:0!important;padding-left:0!important">
_______________________________________________<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/mailman/listinfo/swift-evolution</a><br></div></blockquote></div><br></div>
<img src="https://u2002410.ct.sendgrid.net/wf/open?upn=6ZGE61OxINd5lLe2xYh9Ku-2BXbixWNr2nvfzp2IB1sZh6TKQF8BMklGkmbYn3aAkB6MJpxZ0t4CiiE4yQ7c3-2F-2FxDq-2BE2nhnHvAuBkVBkwM6uDXj3Tn9ItDh6xxQ-2FkLlwiu1hYr6F53gyOSlV8vvG2QFLbE8T144o6I89KhIacPLr89IyBgLNJrrpOeDUJRbKLXLQQTW2cBkYK87e4-2B4ZzjRVbIK6-2FolcNdTCYIDUgxlA-3D" alt="" width="1" height="1" border="0" style="min-height:1px!important;width:1px!important;border-width:0!important;margin-top:0!important;margin-bottom:0!important;margin-right:0!important;margin-left:0!important;padding-top:0!important;padding-bottom:0!important;padding-right:0!important;padding-left:0!important">
</div>
<br>_______________________________________________<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" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
<br></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></blockquote></body></html>