[swift-evolution] [Draft] open and public protocols

David Sweeris davesweeris at mac.com
Sat Feb 18 15:01:33 CST 2017


> On Feb 18, 2017, at 12:41 PM, Matthew Johnson via swift-evolution <swift-evolution at swift.org> wrote:
> 
> ## Source compatibility
> 
> This proposal breaks source compatibility, but in a way that allows for a simple mechanical migration.  A multi-release stratgegy will be used to roll out this proposal to provide maximum possible source compatibility from one release to the next.
> 
> 1. In Swift 4, introduce the `open` keyword and the `@nonopen` attribute (which can be applied to `public protocol` to give it the new semantics of `public`).
> 2. In Swift 4 (or 4.1 if necessary) start warning for `public protocol` with no annotation.
> 3. In the subsequent release `public protocol` without annotation becomes an error.
> 4. In the subsequent relase `public protocol` without annotation takes on the new semantics.
> 5. `@nonopen` becomes a warning, and evenutally an erro as soon as we are comfortable making those changes.

I don’t think we need @nonopen or warnings. IMHO, public/open should have the same semantics and syntax regardless of whether the declaration is a protocol or a concrete type (or a property?).

Other than that nit, I can’t think of a reason to oppose this. So… +1, because I like making things as consistent as possible (also because of the reasons in the motivation).

- Dave Sweeris


More information about the swift-evolution mailing list