[swift-evolution] access control proposal

Matthew Johnson matthew at anandabits.com
Wed Dec 9 11:57:57 CST 2015


> We should be disallowing access modifiers in function contexts anyway.

I didn't mean people would expect to use the access modifier in a function context, but it is common to refer to member variables as 'public', 'internal' or 'private' variables and it is common to refer to variables scoped to a function as local variables.  There has never been any potential for confusion because there has never been a language I know of with a 'local' access modifier.  

If we add one using this keyword I could imagine confusion between members declared with the 'local' access modifier and variables scoped to a function.  The potential for confusion would be most prevalent in new developers, but I can also imagine casual conversations between experienced developers where such confusion might arise.  It's something to consider when thinking about whether or not this would be the best keyword to use.

Matthew


More information about the swift-evolution mailing list