> On Dec 21, 2015, at 10:56 AM, Tino Heth <[email protected]> wrote:
> 
> oh, cool - discussion ;-)

Yes, discussion is good!  I really want to see this seriously considered from 
all angles and the best decision made as an outcome.

> 
>> However, any Swift application is necessarily going to have a lot of classes 
>> as the Cocoa frameworks require apps to subclass framework classes in many 
>> instances.  Even when we are not required to subclass a framework class they 
>> often require our types to be a class, for example when we are providing a 
>> delegate to a Cocoa class.  These requirements of the frameworks result in a 
>> lot of classes in Swift applications that are not ever intended to be 
>> subclassed.
> So you'd vote for making non-final the default again as soon as the 
> "Cocoa-legacy" is gone?

Probably not.  I think it is less clear and less safe.  I would only consider a 
change in my opinion if superclasses became extremely common in application 
level code.  I don’t expect to see that happen.  

We are learning to use techniques such as protocols and composition which are 
more robust than inheritance.  I believe the use cases where inheritance is the 
best solution will continue to decline as our languages become more powerful 
and we learn how to best use the new features.

> 
>> You ask why I don’t think `inheritable` should be the default.  I believe I 
>> have addressed that by making a case that it is less clear and less safe as 
>> a default.
> Sorry if he overlooked something, but I thought the arguments were against 
> the current default…

The current default is to allow inheritance by default.  This is the same as 
`inheritable`, we just don’t have a keyword for it as it isn’t necessary.  So 
yes, the argument is against the current default, which is the same as 
`inheritable` by default.

> What exactly compromises safety when a subclass is allowed to monitor usage 
> of its inherited methods?
> True, when a method is overwritten, the base class might lose something it 
> relies on; but when this can't happen, can you point out an example where 
> this behavior causes danger (damn, I actually know one, but you have to tell 
> first ;-).

This discussion is around making classes final by default.  I also believe 
methods should be final by default but that is a separate discussion.  Let’s 
stay focused on the discussion about classes in this thread.




_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to