[swift-evolution] Final by default for classes and methods

Tino Heth 2th at gmx.de
Mon Dec 21 13:45:12 CST 2015


> Obviously there are some things where you really don't need to call super (mostly abstract methods), but you just said "default", which implies that we could have an opt-out attribute.
> 
> I will say, however, that making NS_REQUIRES_SUPER the default for overridable methods is separable from deciding which methods are overridable by default. Making sure the base method is called isn't really the same as knowing the base method is all that's called.
Well, there are the two extreme positions:
final is as restrictive as possible and the current default, which allows to completely eliminate the inherited code.
NS_REQUIRES_SUPER (the name is imho the by far worst thing of this feature… inheritable sounds really better) is a compromise:
You can make sure that a method does what you want it to do without patronizing the user — and of course theres still room (and need) for final and nonfinal.

Tino
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151221/069f0077/attachment.html>


More information about the swift-evolution mailing list