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

Daniel Duan daniel at duan.org
Sat Feb 27 01:10:06 CST 2016

> 	• What is your evaluation of the proposal?

The proposal does not provide strong enough incentive for adding Abstract
Class. I'm against the proposed change.

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

No. The provided example in the incentive section, as noted by the proposal
itself, can be achieved with protocols and default implementations. The only
problem solved by this example, as well as abstract class as proposed, is that
of a shared property value (port number). IMHO, this problem should be
addressed by enhancing Swift's protocol.

> 	• Does this proposal fit well with the feel and direction of Swift?  • If
> 	you have used other languages or libraries with a similar feature, how do
> 	you feel that this 
proposal compares to those?

Abstract class encourages inheritance (can't use it without), which is only
natural if one assume that OOP is the correct paradigm for problems at hand.
But both industry and academia admits that, historically, OOP had been
over-hyped, abused beyond the domains it actually were useful. Will people be
creating a class just so they can write helloworld in the next decade or two?
I'm sure some will, but I'd like to imagine they have a good reason to do so,
not because "it's the one true way to Swift".  Encouraging inheritance in
a language designed for next few decades seems bad.

Trends and feelings aside, perhaps it's worth noting that in programming
languages such as C++, abstract class, in a lot of use cases, serves as
a workaround for the lack of interface/protocol. It's a "implementation
detail" of single-argument polymorphism. Its other characteristic,
late-binding, can be achieved in Swift in other means. These are the
fundamental reasons why it's hard to produce a convincing example to justify
abstract class. 

(Do we like more ways to do the same thing in Swift is a whole different
discussion. I lean towards no on this one).

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

I read the proposal.

More information about the swift-evolution mailing list