[swift-evolution] [swift-evolution-announce] [Review] SE-0119: Remove access modifiers from extensions

Adrian Zubarev adrian.zubarev at devandartist.com
Wed Jul 13 12:08:19 CDT 2016

Am 13. Juli 2016 um 18:49:11, Jordan Rose (jordan_rose at apple.com) schrieb:

Hi, Adrian. I have to agree with everyone else that the proposal is unclear. “Remove access modifiers from extensions” sounds like you just aren’t allowed to write them at all, but your proposal seems to be more “access modifiers on extensions set a maximum level of access for members, like they do for types, and do not change the default”. (Plus a bit about conformances.) 
I probably misunderstood you in the original proposal thread here: https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20160627/022341.html

I renamed the proposal by thinking that would be the correct technical issue I was addressing. I apologize for any confusion the title have caused.

I am against the latter proposal because I don’t think people should think of extensions as first-class entities. There is really no such thing as a “public extension” or a “private extension” because extensions cannot be referred to in the language and do not have any run-time representation. The access control that really matters is that of the original type, and I wouldn’t want to force people to repeat it here. 
Just for the record:

- What happens under the hood if I extend a specific type?

- Do you create only one single `extension bag` and sort members by the access modifiers from all different extensions?

- How do these members reference to other extensions members which are visible only inside a specific extension?

I am personally all right with the idea of removing access modifiers from extensions altogether, but I know several people like that feature a lot, and I don’t think it passes the criterion of being “a significant enough problem to warrant a change in Swift”. 
I don’t mind if the proposal gets rejected now, at least I’ve seen a bit more feedback now.

PS: One think I might still would want to solve with this proposal is the default access modifier on extensions with protocols.

If you’d think about the rules in the proposed solution, aren’t they exactly how a default access modifier still can be present when there is conformance involved? 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160713/7cf0cbf1/attachment.html>

More information about the swift-evolution mailing list