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

Joseph Lord joseph at human-friendly.com
Fri Feb 26 13:39:54 CST 2016


Requiring sub classing is never necessary and equivalent effects can be achieved by having customisation points in the form of delegates with protocol types (I prefer separate delegates for different aspects of customisation). The delegates can be required in the initializer is they are necessary. If the client wants to subclass they still can and then set the delegate to self.

Inheritance isn't necessarily bad but it is a distinct design choice that should be left to the client code not forced by the library.

Isn't necessary.
Complicates language.
Forces class and inheritance model on client code.
Single inheritance also puts limitations that don't exist with protocols. 

The proposal does say that there are things that can't be achieved by protocols although I didn't understand what they are although it may have been saying protocol extensions which may have limits that delegation does not have. 

I haven't followed the preceding discussion on this proposal but I have been thinking about such things in Swift for some time. This blog post was supporting the access control design and the lack of need for protected which has very similar arguments and alternative approaches as does abstract. There is also some discussion on the post.

One improvement to delegation I would like is to be able to create a property that is either weak or a value type so that delegates are not forced to be classes to avoid retain loops. Maybe it will be possible with property behaviours.


> On Feb 26, 2016, at 6:11 PM, Joe Groff <jgroff at apple.com> 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
> 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
> 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
> 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
> Thank you,
> -Joe
> Review Manager
> _______________________________________________
> swift-evolution-announce mailing list
> swift-evolution-announce at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution-announce
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160226/b0519d43/attachment.html>

More information about the swift-evolution mailing list