[swift-evolution] [Proposal] Sealed classes by default

Matthew Johnson matthew at anandabits.com
Wed Jun 29 15:33:27 CDT 2016



Sent from my iPad

On Jun 29, 2016, at 2:54 PM, John McCall via swift-evolution <swift-evolution at swift.org> wrote:

>> On Jun 29, 2016, at 11:39 AM, Vladimir.S <svabox at gmail.com> wrote:
>> How about `public(extensible)` ?
> 
> Hmm.  I started to work out an example with these as separate modifiers, and I think I understand the need to combine them in some way.
> 
> I wonder if just "extensible" would be good enough.  It is a term that's used in API descriptions.

'extensible' is a broad term.  That has both advantages and disadvantages.  

An advantage is that it can be used to mean both 'subclassable' / 'inheritable' as well as 'overridable'.  This would allow us to use a single keyword, while sealing methods by default in 'extensible' classes.  

A disadvantage is that is isn't immediately clear what kind of extensibility is provided - you just have to know what the keyword means in a specific context.

Perhaps a larger disadvantage is that 'extensible' shares a root with 'extension' and all public classes are open to extension in Swift.  

-Matthew

> 
> John.
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution



More information about the swift-evolution mailing list