[swift-evolution] [Review] SE-0026 Abstract classes and methods
Stephen Celis
stephen.celis at gmail.com
Fri Feb 26 20:19:04 CST 2016
> What is your evaluation of the proposal?
In its current state: -1
I'd love for the proposal to present clear examples of problems that exist in Swift that cannot be solved in any other way. The "RESTClient" example is overly simplistic and can be solved easily using POP:
protocol RESTClient {
var: url: String { get }
}
extension RESTClient {
performNetworkCall() {
// impl
}
}
final class MyRestServiceClient: RESTClient {
let url = "http://www.foo.com/client"
}
In fact, the problem it presents doesn't even need POP:
final class RESTClient {
let url: String
init(url: String) { self.url = url }
performNetworkCall() { /* impl */ }
}
If the proposal were to be updated with better examples that _cannot_ be solved without abstract classes, or at the very least cannot be solved without significant sacrifices to the quality of the code, I would reconsider it.
I believe the proposal would also need to be updated to address other unanswered questions brought up in this thread.
--
Stephen
More information about the swift-evolution
mailing list