[swift-evolution] [Draft] Harmonize access modifiers for extensions
xiaodi.wu at gmail.com
Sat Jul 16 13:16:34 CDT 2016
On Sat, Jul 16, 2016 at 1:13 PM, Adrian Zubarev via swift-evolution <
swift-evolution at swift.org> wrote:
> Have you by any chance meant this?
> You can extend a class, structure, or enumeration in any access context in
> which the class, structure, or enumeration is available. Any type members
> added in an extension have the same default access level as type members
> declared in the original type being extended. If you extend a public or
> internal type, any new type members you add will have a default access
> level of internal. If you extend a private type, any new type members you
> add will have a default access level of private.
> [HERE]: *Alternatively, you can mark an extension with an explicit access
> level modifier (for example, private extension) to set a new default access
> level for all members defined within the extension.*
> This new default can still be overridden within the extension for
> individual type members.
> This is not according SE–0025 to me. It’s how access control on extensions
> worked all the time (which I misunderstood when posting my first draft).
Ah right; it is how it's always worked. I will amend the Motivation section
to say that.
Am 16. Juli 2016 um 20:04:38, Xiaodi Wu via swift-evolution (
> swift-evolution at swift.org) schrieb:
> According to SE-0025, a method moved from the body of a public struct into
> a public extension becomes public without modification. This is surprising
> behavior contrary to Swift's general rule of not exposing public API by
> swift-evolution mailing list
> swift-evolution at swift.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution