[swift-evolution] [Review] SE-0117: Default classes to be non-subclassable publicly
Károly Lőrentey
karoly at lorentey.hu
Fri Jul 8 09:09:20 CDT 2016
> * What is your evaluation of the proposal?
Strong +1. I believe supporting public inheritance is the single most
complicated thing in modern API design; thus, allowing inheritance to
happen without explicit approval of the API designer is clearly a bad
idea.
I'm OK with the proposed keywords (subclassable/overridable), but I
like "open" even more.
I think "base class"/"base func" or "super class"/"super func" would
also read well.
> * Is the problem being addressed significant enough to warrant a
> change to Swift?
Yes. This proposal helps third-party API writers avoid a major source
of pitfalls.
> * Does this proposal fit well with the feel and direction of Swift?
Absolutely. Having sensible/safe defaults for such toggles feels like a
major feature in Swift.
> * If you have used other languages or libraries with a similar
> feature, how do you feel that this proposal compares to those?
Java is a huge poster child for object oriented programming, which is
often misunderstood to be primarily about inheritance. Still,
collections of Java best practices invariably include strongly worded
advice for preferring composition over inheritance, and I especially
like the following rule:
Design and document for inheritance or else prohibit it.
-- Joshua Bloch: Effective Java. Addison-Wesley, 2001.
Even in Java, it is a bad idea to leave classes subclassable; but
having to remember to add final is a chore.
SE-0117 takes this a step further by allowing package writers to use
inheritance internally when it makes sense, without also having to take
on the complications arising from allowing third-party inheritance --
such as having to write a reasonably complete unit test suite for
superclass-subclass interactions. This is an interesting improvement
over final-by-default (which I'd also support).
> * How much effort did you put into your review? A glance, a quick
> reading, or an in-depth study?
I carefully read it, drank a cup of my favorite beverage to celebrate
its existence, then I collected my thoughts.
--
Karoly
@lorentey
On 2016-07-05 23:11:17 +0000, Chris Lattner via swift-evolution said:
> Hello Swift community,
>
> The review of "SE-0117: Default classes to be non-subclassable
> publicly" begins now and runs through July 11. The proposal is
> available here:
>
>
> https://github.com/apple/swift-evolution/blob/master/proposals/0117-non-public-subclassable-by-default.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.
>
> What goes into a review?
>
> The goal of the review process is to improve the proposal under review
> through constructive criticism and contribute to 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,
>
> -Chris Lattner
> Review Manager
>
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
--
Károly
@lorentey
More information about the swift-evolution
mailing list