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

Jean-Daniel Dupas mailing at xenonium.com
Fri Feb 26 16:35:36 CST 2016


> Le 26 févr. 2016 à 23:21, David Scrève via swift-evolution <swift-evolution at swift.org> a écrit :
> 
> 	Actually, protocols and extensions cannot handle methods that requires attributes and data storage.
> 
> 	So, by design, protocols and extensions can only be used to implement stateless interface where abstract classes are true classes with a state supported with attributes and properties.
> 
> 	Abstract class can also enforce methods to be implemented and avoid misuse of default method implementation.
> 
> 	For example, NSOperation is a good candidat to abstract class because NSOperation itself is useless as a standalone class and should not be used as-it.  -(void)main should be made abstract because I don’t think NSOperation does not have any internal property and has default behavior.

IMHO, NSOperation could be better design using closure. Abstract class is probably a concept that fit well with API that where design with it in mind, but it does not mean it is needed in Swift.

> David
>> I am against the proposal. I believe that protocols, mix-ins and composition are better answers to the problems that abstract classes are usually called to solve. In my experience, abstract classes lead to subpar design decisions.
>> 
>> > 	• Is the problem being addressed significant enough to warrant a change to Swift?
>> 
>> I do not believe so. There are most likely cases where current tools could be improved, by that should be done by improving support for behavior composition rather than forced subclassing
>> 
>> > 	• Does this proposal fit well with the feel and direction of Swift?
>> 
>> I do not believe so, for the reason outlined above
>> 
>> > 	• If you have used other languages or libraries with a similar feature, how do you feel that this proposal compares to those?
>> > 	• How much effort did you put into your review? A glance, a quick reading, or an in-depth study?
>> 
>> A quick glance. 
>> 
>> 
>> > On 26 Feb 2016, at 19:11, Joe Groff via swift-evolution <swift-evolution at swift.org <https://lists.swift.org/mailman/listinfo/swift-evolution>> wrote:
>> > 
>> > 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 <https://github.com/apple/swift-evolution/blob/master/proposals/0026-abstract-classes-and-methods.md> <https://github.com/apple/swift-evolution/blob/master/proposals/0026-abstract-classes-and-methods.md <https://github.com/apple/swift-evolution/blob/master/proposals/0026-abstract-classes-and-methods.md>>
>> > Reviews are an important part of the Swift evolution process. All reviews should be sent to the swift-evolution mailing list at
>> > 
>> > https://lists.swift.org/mailman/listinfo/swift-evolution <https://lists.swift.org/mailman/listinfo/swift-evolution> <https://lists.swift.org/mailman/listinfo/swift-evolution <https://lists.swift.org/mailman/listinfo/swift-evolution>>
>> > or, if you would like to keep your feedback private, directly to the review manager. When replying, please try to keep the proposal link at the top of the message:
>> > 
>> > Proposal link:
>> > 
>> > https://github.com/apple/swift-evolution/blob/master/proposals/0026-abstract-classes-and-methods.md <https://github.com/apple/swift-evolution/blob/master/proposals/0026-abstract-classes-and-methods.md> <https://github.com/apple/swift-evolution/blob/master/proposals/0026-abstract-classes-and-methods.md <https://github.com/apple/swift-evolution/blob/master/proposals/0026-abstract-classes-and-methods.md>>
>> > Reply text
>> > 
>> > Other replies
>> > 
>> > What goes into a review?
>> > 
>> > The goal of the review process is to improve the proposal under review through constructive criticism and, eventually, determine the direction of Swift. When writing your review, here are some questions you might want to answer in your review:
>> > 
>> > 	• What is your evaluation of the proposal?
>> > 	• Is the problem being addressed significant enough to warrant a change to Swift?
>> > 	• 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?
>> > 	• How much effort did you put into your review? A glance, a quick reading, or an in-depth study?
>> > 
>> > More information about the Swift evolution process is available at:
>> > 
>> > https://github.com/apple/swift-evolution/blob/master/process.md <https://github.com/apple/swift-evolution/blob/master/process.md> <https://github.com/apple/swift-evolution/blob/master/process.md <https://github.com/apple/swift-evolution/blob/master/process.md>>
>> > Thank you,
>> > 
>> > -Joe
>> > Review Manager
>> > _______________________________________________
>> > swift-evolution mailing list
>> > swift-evolution at swift.org <https://lists.swift.org/mailman/listinfo/swift-evolution>
>> > https://lists.swift.org/mailman/listinfo/swift-evolution <https://lists.swift.org/mailman/listinfo/swift-evolution>
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution

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


More information about the swift-evolution mailing list