[swift-evolution] Proposal: Add @requires_super attribute

Tino Heth 2th at gmx.de
Thu Dec 17 02:24:04 CST 2015


> 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. 
Do you have concrete examples for this claim?
Even if my impression that it doesn't matter in most cases is wrong, imho the argument is like advising not to wear a helmet on the construction site because it doesn't protect your feet.
Additionally, it can be easily addressed ("@prepend, @append"...)

> 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. 
Why?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151217/161e559a/attachment.html>


More information about the swift-evolution mailing list