<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Nov 17, 2016, at 2:54 AM, Tino Heth via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=us-ascii" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">An equivalent of "NS_REQUIRES_SUPER" (hopefully with a better name ;-) has been requested several times, but never got the momentum it deserves.</div></div></blockquote><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">Considering the current confusion (especially in UIKit), it would be really nice to have some help from the compiler, and I wonder how composition and protocols would be helpful here at all.</div><div class=""><br class=""></div></div></div></blockquote><div><br class=""></div><div><br class=""></div><div><div>As an intermediary measure, this seems like an interesting QoI improvement for the compiler: warn when super.foo() is not called in the overridden method. This is probably best done through a Clang-side attribute to begin with (as UIKit and others are the biggest bang for the buck for this), and of course some kind of NS_* convenience macro could be added.</div><div><br class=""></div><div>What are your thoughts on this?</div><div><br class=""></div><div>Just to throw out a strawman:</div><div><br class=""></div><div>// Warn if override doesn’t begin with “super.foo()”</div><div>__attribute(swift_requires_super_call_at_begin)&nbsp;</div><div><div><br class=""></div><div>&nbsp;// Warn if override doesn’t end with “super.foo()”</div><div>__attribute(swift_requires_super_call_at_end)</div><div class=""><br class=""></div></div></div><br class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">I guess the problem is that there are to many options for this feature without an obvious favorite: Not only for the keywords, but also for the exact semantic.</div><div class=""><br class=""></div><div class="">Additionally, there are imho already to many access levels (private, fileprivate, internal, public, <i class="">extendable?</i>, open), so I hope we'll someday find a solution that is powerful enough to replace the special willSet/didSet treatment for properties as well.</div><div class=""><br class=""></div></div></div></blockquote><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">So unless somebody has a real flash of genius, I guess it's better to delay discussion until there is a chance for new proposals to be accepted.</div><div class=""><br class=""></div><div class="">Tino</div></div>_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></blockquote></div><br class=""></body></html>