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

Brent Royal-Gordon brent at architechies.com
Wed Dec 23 14:35:22 CST 2015

> If the frameworks are written in Swift, nothing is stopping Apple from slapping 'final' on all the classes they don't want developers to inherit from, even if the proposal is rejected; neither is there anything stopping them from making all their classes inheritable (if that happened to be what they wanted, which it isn't).

You cannot look at a language simply as a technical artifact. A language creates culture and shapes the systems written in it. It defines not only what is possible and what is not, but also what is preferred and what is discouraged. Defaults matter. If they didn't, people wouldn't be trying to change the default.

Making `final` the default, or `sealed` the default, encourages the use of closed class hierarchies. It attempts to make inflexibility the preferred form of shared Swift code. I'm not sure that's the right thing to do.

Brent Royal-Gordon

More information about the swift-evolution mailing list