“The access modifier of an extension sets the default modifier of its members
which has no modifier applied to them.”
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. :)
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).
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
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution