[swift-evolution] [Review] SE-0117: Default classes to benon-subclassable publicly
Colin Cornaby
colin.cornaby at mac.com
Mon Jul 11 18:54:06 CDT 2016
> - Slippery Slope: SE-0117 adds yet another entry to the already huge list of things in Swift that subtly or openly discourage people from subclassing. How far are we from someone seriously proposing to outright rip inheritance out of the language? Enough is enough. Stop with the anti-subclassing propaganda. Implementation inheritance is a hugely important core language feature whose popularity should be preserved and whose use should be encouraged and celebrated.
This is another reason I’m unclear on the reasoning behind this proposal, but I could be missing something… Structs have been pushed in Swift primarily as classes without polymorphism. One would think that one of the primary reasons to adopt a class structure in Swift is polymorphism. It seems backwards to make the point of a class primarily polymorphism, and then disable it by default.
I suppose you could make the case you’d want to inherit from a parent class but not allow other classes to inherit from you. This just seems like more of a mess though. I could have vendors shipping me view controllers that I can’t inherit from, complicating my own designs.
(The other big reason I still use a lot of classes in Swift is Cocoa compatibility, but I’m assuming Obj-C compatible Swift objects won’t support final or final-by-default anyway.)
Someone correct me if I’m missing something big here though.
More information about the swift-evolution
mailing list