[swift-evolution] Replace the override keyword by 'extend' and 'replace' or add an annotation like @SuppressSuperCall

Brent Royal-Gordon brent at architechies.com
Tue Feb 16 19:22:01 CST 2016

> Building on Haravikk's suggestion:
>     1. Make methods and classes final by default

That's a serious problem for Swift resilience—it's not safe to change a public class from final to non-final because that would break devirtualized calls in other modules. Whatever the default is, it needs to not break things.

Overall, I don't like this proposal for several reasons:

- It conflates several different features—final, abstract, super call requirement, super call location—into a single set of annotations.
- It violates the usual grammar of Swift declarations by attaching particular modifiers directly to the keyword, disrupting the usual flow of modifiers-keyword-name-type.
- It not only supports, but actively encourages, placing extremely heavy constraints on subclass implementations. (Want to put a logging statement before a "before" method's super call or after an "after" method's? Too bad, the guy who wrote the superclass said "no".)

In general, this proposal seems like it's tremendously overengineered, insufficiently motivated, and fits poorly into Swift's syntax.

Brent Royal-Gordon

More information about the swift-evolution mailing list