[swift-evolution] SE-0025: Scoped Access Level, next steps

Brent Royal-Gordon brent at architechies.com
Wed Mar 16 18:01:10 CDT 2016


> Per Doug’s email, the core team agrees we should make a change here, but would like some bikeshedding to happen on the replacement name for private.
> 
> To summarize the place we’d like to end up:
> 
> - “public” -> symbol visible outside the current module.
> - “internal” -> symbol visible within the current module.
> - unknown -> symbol visible within the current file.
> - “private” -> symbol visible within the current declaration (class, extension, etc).

I think moving `private` to this new access control level because it's the most private one we currently have sets a bad precedent. If we add a fifth level in Swift 4 (say, one that hides the member from nested types), does that now become `private` and we need to come up with a new name for the fourth level? Will users ever be able to get used to what the keywords actually mean?

Rather than use relative terms, let's use absolute ones. An extreme, imperfect example of what I mean:

* exported
* module
* file
* scope

Then if we add other access levels in the future, we don't have to worry about reshuffling the existing names, because they will all still be correct. We just have to come up with a good name for the new one.

-- 
Brent Royal-Gordon
Architechies



More information about the swift-evolution mailing list