[swift-evolution] access control proposal

Matthew Johnson matthew at anandabits.com
Sat Dec 12 09:26:11 CST 2015


I had been thinking “scope” might make sense. “scoped” might be even better.  I like both of those better than “local” and “classified”.

> On Dec 11, 2015, at 9:45 PM, Ilya <ilya at harmonicsense.com> wrote:
> 
> I think that "private" as it is already causes more confusion than "local". Another alternative I can think of is "scoped" or some variant of that. It would be nice to have a good unambiguous name for it. Right now I just hope that we can get it with *some* name.  I'd be willing to do the work if it could help make it happen.
> 
> --
> Ilya Belenkiy
> 
> On Wed, Dec 9, 2015 at 1:07 PM John McCall <rjmccall at apple.com <mailto:rjmccall at apple.com>> wrote:
> > On Dec 9, 2015, at 9:57 AM, Matthew Johnson <matthew at anandabits.com <mailto:matthew at anandabits.com>> wrote:
> >> 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.
> 
> That’s a very good point.
> 
> John.

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


More information about the swift-evolution mailing list