[Review #2] SE-0117: Default classes to be non-subclassable publicly


(James Froggatt) #1

Based on the discussion, I think the real danger of subclassing is unexpected behaviour - in other words, overriding methods. There doesn't seem to be a need to penalise subclasses which just add properties and extra methods based on them.

I'd be in favour of keeping current behaviour for classes, but having to mark methods explicitly as overrideable, virtual, open, or whatever semantics we decide upon. This seems like the safest syntax.

I'd also support a grouping mechanism for marking methods in this way, similar to extensions' current auto-annotation for ‘public’.

------------ Begin Message ------------
Group: gmane.comp.lang.swift.evolution
MsgID: <2C9B4C5A-52C2-4E0E-8B9E-6E5444629D85@apple.com>

Hello Swift community,

The second review of "SE-0117: Default classes to be non-subclassable publicly" begins now and runs through July 22. 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@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

------------- End Message -------------


(Chéyo Jiménez) #2

Based on the discussion, I think the real danger of subclassing is unexpected behaviour - in other words, overriding methods. There doesn't seem to be a need to penalise subclasses which just add properties and extra methods based on them.

I'd be in favour of keeping current behaviour for classes, but having to mark methods explicitly as overrideable, virtual, open, or whatever semantics we decide upon. This seems like the safest syntax.

I'd also support a grouping mechanism for marking methods in this way, similar to extensions' current auto-annotation for ‘public’.

The is a proposal waiting to be merged that seeks to disallow public extensions auto-annotation. I think extensions would be better with out it.

···

On Jul 19, 2016, at 4:13 AM, James Froggatt via swift-evolution <swift-evolution@swift.org> wrote:

------------ Begin Message ------------
Group: gmane.comp.lang.swift.evolution
MsgID: <2C9B4C5A-52C2-4E0E-8B9E-6E5444629D85@apple.com>

Hello Swift community,

The second review of "SE-0117: Default classes to be non-subclassable publicly" begins now and runs through July 22. 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@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

------------- End Message -------------
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution


(James Froggatt) #3

Based on the discussion, I think the real danger of subclassing is unexpected behaviour - in other words, overriding methods. There doesn't seem to be a need to penalise subclasses which just add properties and extra methods based on them.

I'd be in favour of keeping current behaviour for classes, but having to mark methods explicitly as overrideable, virtual, open, or whatever semantics we decide upon. This seems like the safest syntax.

I'd also support a grouping mechanism for marking methods in this way, similar to extensions' current auto-annotation for ‘public’.

The is a proposal waiting to be merged that seeks to disallow public extensions auto-annotation. I think extensions would be better with out it.

Indeed, hence why I'm calling it a ‘grouping mechanism’ for now. If this is removed from extensions, I'm hoping for a more focused replacement - not so much because I'm a lazy typer, but rather because it supports the addition of this sort of granular access control, while keeping boilerplate to a minimum.

···

On 19 Jul 2016, at 17:05, Jose Cheyo Jimenez <cheyo@masters3d.com> wrote:

On Jul 19, 2016, at 4:13 AM, James Froggatt via swift-evolution <swift-evolution@swift.org <mailto:swift-evolution@swift.org>> wrote:

------------ Begin Message ------------
Group: gmane.comp.lang.swift.evolution
MsgID: <2C9B4C5A-52C2-4E0E-8B9E-6E5444629D85@apple.com>

Hello Swift community,

The second review of "SE-0117: Default classes to be non-subclassable publicly" begins now and runs through July 22. 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@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

------------- End Message -------------
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org <mailto:swift-evolution@swift.org>
https://lists.swift.org/mailman/listinfo/swift-evolution