<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">When a superclass method must be called either before or after the override it would be ideal to have the compiler synthesize the call rather than just verify the developer writes it. The developer should only need to write it when they need control over when that call happens.<div class=""><br class=""></div><div class="">willSet and didSet are pretty similar to this synthesis, but rather than synthesizing a call to super the compiler synthesizes the entire setter with the willSet and / or didSet code in the appropriate location(s).<br class=""><div class=""><br class=""></div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Dec 16, 2015, at 8:28 PM, T.J. Usiyan via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">one solution is @requires_super(first|last). This cuts out "call me in the middle" but that is a worthwhile trade, in my opinion.</div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Wed, Dec 16, 2015 at 9:22 PM, Javier Soto via swift-evolution <span dir="ltr" class=""><<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I'm not a fan of this feature because it encourages a type of API design that's really hard to ensure that it's used correctly. The biggest problem is the fact that often when a class expects or allows a method to be overriden, and super needs to be called, it expects the call to happen in a particular order: either before of after the implementation from the subclass. <br class=""><br class="">So yes, this is missing from Obj-C, yes, this is important because UIKit, but going forward my feeling is that a language without this feature is a language that will force you to think about an alternative way to implement an API without this, and that'll probably be less error-prone. <br class=""><div class="gmail_quote"><div class=""><div class="h5"><div dir="ltr" class="">On Wed, Dec 16, 2015 at 3:03 PM Tino Heth via swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>> wrote:<br class=""></div></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class=""><div class="h5"><div style="word-wrap:break-word" class=""><div class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class="">Default behavior would require something like "unrequire" which seems odd.</div></div></blockquote></div></div><div style="word-wrap:break-word" class=""><div class=""><div class="">the keyword for requires_super is so odd, it doesn't even fit in a single word! ;-)</div><div class="">I think it is much easer to find a word for something that can be replaced completely than for "you have to call the implementation of the parent class"</div></div></div><div style="word-wrap:break-word" class=""><div class=""><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class=""><div class=""><div class="">Also this would break a lot of existing code and migration can't be done automatically.</div></div></div></div></blockquote></div></div><div style="word-wrap:break-word" class=""><div class=""></div>Two parts:<div class="">What is a lot? I really don't think calling super hurts in many places.</div><div class="">Why shouldn't it be possible to migrate automatically? It might get complicated for compiled libs, but definitely possible.</div>
<img src="https://u2002410.ct.sendgrid.net/wf/open?upn=EmLgVGNgdilXys3cXWyAWvOFC2-2FejnHkMVv8PyEdfbpIiAM0sw8SMjmNpeDYfJaeBiBK-2BepRu7apL4KrlbvDgP-2Fqb5QKul7yZHL2m5H6Dn2-2FeB9gFlG6LM4B294z0bkqXKfaNERDK5UwZLPLO-2FdaF27cNWZ11JCQKVaGLyqFvWcuabeU0ppgsN7zCqTqdeGbPN9g-2Fd5v2-2BLqFmH9yCA8LvpcILqw-2FlnSzv9Wc05N6z4-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" class="">
</div></div></div><span class="">
_______________________________________________<br class="">
swift-evolution mailing list<br class="">
<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a><br class="">
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class="">
</span></blockquote></div><span class="HOEnZb"><font color="#888888" class=""><div dir="ltr" class="">-- <br class=""></div>Javier Soto
<img src="https://u2002410.ct.sendgrid.net/wf/open?upn=3FGfocPbgxkNkmje7djckg9Iw-2BGYY3X6RxJ1tkUXKCro3KPh8Esu-2FpH3F1VuahQb8u0LT79wTah0YPx-2F2jbMOEVOX0tZQHr7misqlS2APy-2BmP5zW0pXiEbyMqmlFa44j7-2Fecqv-2FVgrJjBO2aNHveOf6v-2FkCWYe5AFG2K30GfO-2FkUS7OAbjMu-2BlaJ0KrGXS4uN1TRyDxoEXHKK09j0xkMnS23GZX04IvAfLFzcsZSrYw-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" class="">
</font></span><br class="">_______________________________________________<br class="">
swift-evolution mailing list<br class="">
<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class="">
<br class=""></blockquote></div><br class=""></div>
<img src="https://u2002410.ct.sendgrid.net/wf/open?upn=eLFMrKDT8iBxZ-2Fbnk-2BZqvSchNN-2FvYXdceA0T7VxwkAdyEq3S9t5nHZL24PxYMohyys6lopEikzF622cLqFUbBZp2PiWf7rYSPfGZ8Z1Tkt9mOhq2PtrGg6hKbX3ZBDOr1NyvOn-2BzzmAukfDrSWzZbGe0AhJ-2FLWMt5oLJUtyzLPY-2FDqcD80VCxtCUckBrFYG7DDh7UxHdj7cfn2BpvZWpXklIP4tPMc9NKbugjxM2zUc-3D" alt="" width="1" height="1" border="0" style="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;" class="">
_______________________________________________<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=""></div></div></body></html>