[swift-evolution] Proposal: Add @requires_super attribute

T.J. Usiyan griotspeak at gmail.com
Wed Dec 16 16:14:22 CST 2015


I think that the problem with making it a default behavior is that you
can't be sure *when* to call super in a child implementation. you should
call in the middle for init but in the beginning for viewDidLoad and
(sometimes) at the end for dealloc.

On Wed, Dec 16, 2015 at 5:04 PM, Tino Heth via swift-evolution <
swift-evolution at swift.org> wrote:

> A huge +1 on this — I'd actually go one step further and propose to make
> it the default behavior:
> Calling super rarely hurts, and it would be easier to find a better name
> for the attribute ;-) (maybe "replaceable"…)
> Additionally, it is one step in the right direction for those who think
> "final" should be default (if there is any good reason to prefer final over
> requires_super, I haven't seen it yet).
>
> Instead of enforcing the call to super, it would be possible to
> automatically run the super implementation after (or before) the overriding
> method (unless it is explicitly called).
> _______________________________________________
> 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/20151216/2d285923/attachment.html>


More information about the swift-evolution mailing list