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

Jordan Rose jordan_rose at apple.com
Mon Mar 28 20:32:32 CDT 2016


> On Mar 28, 2016, at 18:20, Matthew Judge <matthew.judge at gmail.com> wrote:
> 
> There are two different  questions that we keep bouncing back and forth between. Given:
> 
> class Outer {
>     private var outerVar: Int
>     class Inner {
>         private var innerVar: Int
>     }
> }
> 
> Is outerVar visible inside Inner? To me this seems 'obvious'... Yes.
> 
> Is innerVar visible to Outer? The answer to this impacts what I think the access modifiers should be called.

Fair question. Data:

- C++: no, but the language has "friend".
- Java: yes
- C#: no

- Ruby: no, but "private" means something slightly different
- D: yes, but "private" means something more like Swift's current "private"

- Kotlin: no
- Scala, Python, Go, Rust, Objective-C, Smalltalk: either no access control or no nested types, AFAICT

So it's tending towards "no" but it's not as consistent. I agree that if we pick "yes" then (for example) "scoped" would be a confusing name.

Jordan



More information about the swift-evolution mailing list