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

John McCall rjmccall at apple.com
Thu Jun 30 16:02:36 CDT 2016


> On Jun 30, 2016, at 1:50 PM, Xiaodi Wu <xiaodi.wu at gmail.com> wrote:
> On Thu, Jun 30, 2016 at 3:47 PM, John McCall <rjmccall at apple.com <mailto:rjmccall at apple.com>> wrote:
>> On Jun 30, 2016, at 1:44 PM, Xiaodi Wu <xiaodi.wu at gmail.com <mailto:xiaodi.wu at gmail.com>> wrote:
>> On Thu, Jun 30, 2016 at 3:36 PM, John McCall <rjmccall at apple.com <mailto:rjmccall at apple.com>> wrote:
>>> On Jun 29, 2016, at 1:33 PM, Xiaodi Wu <xiaodi.wu at gmail.com <mailto:xiaodi.wu at gmail.com>> wrote:
>>> On Wed, Jun 29, 2016 at 2:54 PM, John McCall via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
>>> > On Jun 29, 2016, at 11:39 AM, Vladimir.S <svabox at gmail.com <mailto: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.
>>> 
>>> This particular word is unfortunate because it has nothing to do with an extension, which shares the same etymological root.
>> 
>> I agree, but I'm not sure that it's particularly confusing in practice.
>>  
>> Why not just "inheritable"? That is, after all, what we mean, no?
> 
> All class methods are intrinsically inheritable.  A non-inheritable method would *require* an override.
> 
> Sorry, I was more suggesting that word in the context of `public(inheritable)`, provided the default is sealed.

The same argument applies: both sealed and unsealed methods are capable of being inherited.  And you don't inherit classes, you inherit *from* them.

If we're going to go along those lines, we should just use public(subclassable) and public(overridable).  We can fall back on those if necessary; I would just like to continue looking for better alternatives.

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


More information about the swift-evolution mailing list