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

Gwendal Roué gwendal.roue at gmail.com
Sun Feb 28 05:42:11 CST 2016


> Hello Swift community,
> 
> The review of “Abstract classes and methods” begins now and runs through March 4, 2016. The proposal is available here:
> 
> https://github.com/apple/swift-evolution/blob/master/proposals/0026-abstract-classes-and-methods.md
> 
> 	• What is your evaluation of the proposal?

Positive.

Many voices here have a major bias for POP against OOP, and the Crusty character of the founding https://developer.apple.com/videos/play/wwdc2015/408/ session was indeed a very well-done marketing coup both in favor of POP, and against OOP.

Yet I think that code that uses abstract classes is not, per se, bad code which needs refactoring using POP. It’s just code that uses abstract classes, and it may have its (excellent) reasons.


> 	• Is the problem being addressed significant enough to warrant a change to Swift?

I think so, for two reasons:

1. Many abstract classes exist in the wild, and they currently have to fallback to runtime errors like "subclass must override". Compiler support would be a great bonus.

2. Protocol-based refactoring of abstract classes falls short because protocols miss three major features provided only by base classes: `super`, properties, and encapsulation of implementation details that allows easy refactoring of inner guts. For more details: https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20160104/005755.html, https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20160104/005862.html.


> 	• Does this proposal fit well with the feel and direction of Swift?

Yes it does, since Swift does provide class inheritance as a matter of fact, and fosters safety at the compile time.


> 	• If you have used other languages or libraries with a similar feature, how do you feel that this proposal compares to those?

Other languages do not have the Swift protocols that are the main argument of opponents to abstract classes. So the comparison with other languages may be useless here.

Yet if Swift would support it, it could help a lot welcoming programmers that are familiar with other languages, and bring their OOP experience to the community.


> 	• How much effort did you put into your review? A glance, a quick reading, or an in-depth study?

A quick reading of the proposal. It may be rough on some edges.

Gwendal Roué



More information about the swift-evolution mailing list