[swift-evolution] Add code to super methods.

Kevin Nattinger swift at nattinger.net
Fri Nov 25 10:36:59 CST 2016


I agree. An NS_REQUIRES_SUPER equivalent was on my list of things to propose during stage 2, and I don't see a reason to enforce order. 


> On Nov 25, 2016, at 04:42, Tino Heth via swift-evolution <swift-evolution at swift.org> wrote:
> 
> 
>> What are your thoughts on this?
>> 
>> Just to throw out a strawman:
>> 
>> // Warn if override doesn’t begin with “super.foo()”
>> __attribute(swift_requires_super_call_at_begin) 
>> 
>>  // Warn if override doesn’t end with “super.foo()”
>> __attribute(swift_requires_super_call_at_end)
> 
> I myself would already be happy if Swift had an equivalent to NS_REQUIRES_SUPER (preferably with a different name ;-).
> The ability to indicate that super shouldn't be called when overriding would be nice as well ― both situations happen in Cocoa, and it isn't enforced, but only documented.
> 
> I don't have any examples where the position of the call to super matters, and my personal opinion is that this feature wouldn't pay off:
> Of course, there are situations where order is important ― but as with willSet/didSet, it might only be important for the overriding class, not for super.
> 
> - Tino
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20161125/6c4acf1b/attachment.html>


More information about the swift-evolution mailing list