[swift-evolution] [swift-evolution-announce] [Review] SE-0026 Abstract classes and methods

Joseph Lord joseph at human-friendly.com
Fri Feb 26 18:20:03 CST 2016


>>> https://github.com/apple/swift-evolution/blob/master/proposals/0026-abstract-classes-and-methods.md



> On Feb 26, 2016, at 9:58 PM, <Sender redacted as they replied to me not list> wrote:
> 
> +1
> 
> I do not see his proposal as forcing inheritance, but letting it fight more and more without a hand tied behind its back. Composition and mixins should be strengthened, but that does not mean that inheritance should not be improved. 
> 
> Trust coders to make the right decisions, do not withhold tools from them. Inheritance is part of Swift and a supported paradigm, nothing wrong with using it well and this proposal adds a tool to the inheritance toolbox, without forcing people to use that pattern or withholding progress for functional aspects of the language and other patterns.

The proposal does not force inheritance but anyone using abstract does force it on code using the abstract class.

In my view it is those who want abstract classes that are not trusting coders. If you want to use inheritance please do, I sometimes do too although with decreasing frequency over time. Making abstract classes forces all users of your code to subclass 

My -1 is probably a bit strong, maybe minus 0.5 is more like but I do think that it would encourage patterns that:
a) I don't particularly like
b) tend to have effects that pervade deeply into code bases.

When I programmed in Java and C++ in the fairly distant past I used abstract classes heavily (although often for interfaces/protocols) but since developing in Objective-C and more recently Swift and using Cocoa Touch libraries I've really come to appreciate delegation. I have also over time become more concerned with the risks and complexities of inheritance which I think should be regarded as an advanced rather than a basic technique. I fear this proposal would force library users to adopt inheritance. I think abstract classes are best discouraged rather than supported. 

Joseph

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


More information about the swift-evolution mailing list