[swift-evolution] [Review #2] SE-0117: Default classes to be non-subclassable publicly
xiaodi.wu at gmail.com
Sat Jul 16 02:59:31 CDT 2016
> * What is your evaluation of the proposal?
This is improved from the previous iteration. The code example needs
updating, as both instances of `open func bar()` should be `public open
func bar()` as outlined in the Proposed Design section.
> * Does this proposal fit well with the feel and direction of Swift?
Yes, mostly. There is one comment in the code example that describes a
restriction which does not fit with the direction of Swift. It is not the
main focus of the proposal but I think should be changed. Namely, the
"[The declaration `[public] open func bar()` inside a class not marked
`open`] raises a compilation error: a method can't be marked `open` if the
class it belongs to can't be subclassed."
This is discordant with the direction resolved by the core team in the
SE-0025 revisions, where it was stated with regard to access modifiers:
"The compiler should not warn when a broader level of access control is
used within a type with more restrictive access, such as `internal` within
a `private` type. This allows the owner of the type to design the access
they would use were they to make the type more widely accessible."
Applying the same rationale here would suggest that the compiler should not
raise an error if a method is marked `open` inside a non-`open` type, in
order to allow the owner of the type to design as though to make it
subclassable without actually having to do so.
* If you have used other languages or libraries with a similar
> feature, how do you feel that this proposal compares to those?
Yes, I've used OOP in other languages. As discussed, this approach is
different from that taken by many of those but is a deliberate step.
> * How much effort did you put into your review? A glance, a quick
> reading, or an in-depth study?
Followed the discussion, read proposal carefully.
> More information about the Swift evolution process is available at
> Thank you,
> -Chris Lattner
> Review Manager
> swift-evolution mailing list
> swift-evolution at swift.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution