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

Slava Pestov spestov at apple.com
Mon Dec 7 13:18:46 CST 2015


Another idea we've discussed internally is some form of 'sealed' classes. That is, classes that are publicly visible but only subclassable from within their module. This could be used to define closed inheritance hierarchies which give stronger guarantees to the optimizer.

I'd personally be in favor of making that behavior the default.

Slava

> On Dec 7, 2015, at 11:12 AM, Javier Soto via swift-evolution <swift-evolution at swift.org> wrote:
> 
> This was brought up in a different thread about private by default. Creating a new thread for this. Quoting Mathew from the other thread with a short summary about the motivation behind this:
> 
> "It is not uncommon to have a need for a reference type without a need for inheritance.  Superclasses should be intentionally designed to be subclasses and the author required to opt-in to subclassing and member overrides where that is required by the design."
> -- 
> Javier Soto  _______________________________________________
> 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/20151207/3f2e4fa6/attachment.html>


More information about the swift-evolution mailing list