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

Matthew Johnson matthew at anandabits.com
Mon Dec 21 14:23:10 CST 2015



Sent from my iPhone

> On Dec 21, 2015, at 2:03 PM, Tino Heth via swift-evolution <swift-evolution at swift.org> wrote:
> 
> 
>> - 'private' and 'internal' methods are not exposed outside of a library, so you can't call them, much less override them. Similar for 'private' and 'internal' classes: you cannot subclass them.
> really important point — and imho one of the best arguments not to make final the default:
> It IS already the default (practically), so all points regarding own frameworks used by other parties become much less relevant.
> 

This is not true at all.  You are making the case that 'sealed' is "practically" the default, not 'final'.

I can see why you view it this way, but access control and inheritability are orthogonal.   A framework class that needs to be publicly visible does not necessarily need to be inheritable and there are compelling reasons why that should not be allowed by default.


> _______________________________________________
> 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/20151221/08ccc680/attachment.html>


More information about the swift-evolution mailing list