[swift-evolution] Proposal: Add @requires_super attribute
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
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution