[swift-evolution] Add code to super methods.
dabrahams at apple.com
Mon Nov 28 21:22:57 CST 2016
on Thu Nov 24 2016, Michael Ilseman <swift-evolution at swift.org> wrote:
>> On Nov 17, 2016, at 2:54 AM, Tino Heth via swift-evolution
> <swift-evolution at swift.org> wrote:
>> An equivalent of "NS_REQUIRES_SUPER" (hopefully with a better name ;-) has been requested several
> times, but never got the momentum it deserves.
>> 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.
> 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.
Please no. Methods that need to be called when they are overridden are
almost always a result of poor design.
“I don't always do Object Oriented Programming, but when I do, I use
the Template Method Pattern"
More information about the swift-evolution