[swift-evolution] Suggestion to clean up the mess around access modifiers

Adrian Zubarev adrian.zubarev at devandartist.com
Tue Feb 21 08:11:21 CST 2017


It’s not meant to be a proposal but a suggestion to all that mess around the access modifiers that is currently going on. You can take the suggestion from here, if you like it, and write a proper proposal. ;)

Formatted version: https://gist.github.com/DevAndArtist/ae33145aa71a6212981b54c307e7c1e6

Suggestion 1	Suggestion 2	Swift 3
public	open	open
closed public	public	public
fixed public		 
final public	closed	final public
internal	internal	internal
final internal	final internal	final internal
private	private	fileprivate
final private	final private	final fileprivate
scoped	scoped	private
open is no more an exclusive access modifier, which shouldn’t exist in the first place, because of the mentioned exclusivity. That’s what attributes are meant for.
Allowing closed public protocols seems straightforward for Suggestion 1.
First suggestion aligns the closed attribute very well with final and its purpose becomes crystal clear.
scoped is a straw_hat_name from the on going discussions, you can replace it with something better.
fixed public is from Matthew’s discussion thread.
Personally I’d go with #1!



-- 
Adrian Zubarev
Sent with Airmail
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170221/cc1e6bf7/attachment.html>


More information about the swift-evolution mailing list