[swift-evolution] [swift-evolution-announce] [Review] SE-0117: Default classes to be non-subclassable publicly

Jordan Rose jordan_rose at apple.com
Mon Jul 11 16:39:45 CDT 2016


> On Jul 11, 2016, at 00:50, Tino Heth via swift-evolution <swift-evolution at swift.org> wrote:
> 
> 
>> In the implementation of the subclass, there has to be a call to one of the superclass's initializers. If all of the superclass’s initializers are non-public, then there’s no way to write your own initializer. (This is actually true in Swift today.)
> I want to point out that this strange behavior can actually be useful:
> As of now, you cannot create a public subclass with internal ancestors — it's all or nothing.
> When you keep the initializer of the base class internal, you practically seal this class, but it's still possible for framework clients to access the public subclasses supplied for them.

Yes. My point was that we already have something equivalent to what’s being proposed, but it’s ad hoc, and interacts poorly with some other features of the language.

Jordan

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160711/c1610464/attachment.html>


More information about the swift-evolution mailing list