[swift-evolution] [Proposal] Revising access modifiers on extensions
L. Mihalkovic
laurent.mihalkovic at gmail.com
Mon Jun 27 22:59:25 CDT 2016
Regards
(From mobile)
> On Jun 27, 2016, at 11:59 PM, Adrian Zubarev via swift-evolution <swift-evolution at swift.org> wrote:
>
> “The access modifier of an extension sets the default modifier of its members which has no modifier applied to them.”
I get it now.. "which do not have their own localy defined modifier"
> public extension SomeType {
> func extensionMember() {}
> }
> “If there the extension has no access modifier, then the default modifier of its members which has no explicit modifier will be internal if the extended type is either public or internal, or it will be private when the extended type is private(analogous for fileprivate).”
> // First
> public/internal struct A {}
>
> extension A {
>
> /* internal */ func member() {}
> }
>
> // Second
> private struct B {}
>
> extension B {
>
> /* private */ func member() {}
> }
> My English isn’t great, please don’t blame me for that. Feel free to correct me. I’d appreciate that. :)
>
I didn't, i just asked for clarification (i truly did not get the meaning).
> But more importantly, I was under the impression that Doug had hinted that private (or likely more generally scoped) conformance on extension was a slipery slope with important impact on runtime performance.
> I’m not an expert in this area, I really cannot tell. And I don’t want to dig in all these thousands of emails to find his talk. FWIW not every proposal does know the impact which will happen behind the scene. Even some simple change might have a huge impact (I don’t say this proposal is simple).
>
I am no expert myself. I just happened to remember what looked like a partial answer. The generic manifesto has a section on 'Private Conformances' that gives some interesting clues about what's involved in scoping extension based conformances.
> My personal vision of the access control is clarity and consistency. It would be much easier to have the same access control behavior on extensions like on classes, enums and structs.
>
>
> --
> Adrian Zubarev
> Sent with Airmail
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160628/22308dd0/attachment.html>
More information about the swift-evolution
mailing list