<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Mon, Mar 14, 2016 at 5:18 PM Chris Lattner via swift-evolution <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">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.<br>
<br>
To summarize the place we’d like to end up:<br>
<br>
- “public” -> symbol visible outside the current module.<br>
- “internal” -> symbol visible within the current module.<br>
- unknown -> symbol visible within the current file.<br>
- “private” -> symbol visible within the current declaration (class, extension, etc).<br></blockquote><div><br></div><div>More thinking out loud...</div><div><br></div><div><span><div>`public` -> exported from module</div><div><omitted> -> module scoped (e.g. current internal)</div><div>`private` -> class, struct, etc. scoped (e.g. new private)</div><div>`private(file)` or `file` -> file scoped (e.g existing private)</div><div>`private(module)` or `module` or `internal` -> module scoped (e.g. current internal)</div><div><br></div><div>public var foo = 0 // marks default getter and setter public</div><div><br></div><div>public var foo = 0 { // marks default getter and setter public however...</div><div> private set // marks default setter private</div><div>}</div><div><br></div><div>var foo = 0 { // marks default getter and setter module scoped however...</div><div> public get // marks default getter public</div><div> private set // marks default setter private</div><div>}</div><div><br></div><div>public var foo: Int { ... } // marks provided getter public, read-only</div><div><br></div><div>var foo: Int { // marks provided getter and setter module scoped however...</div><div> public get { ... } // marks provided getter public</div><div> private set { ... } // marks provided setter private</div><div>}</div><div><br></div><div>public var foo: Int { // marks provided getter and setter public however...</div><div> get { ... } // not specified, inherit access level public</div><div> private set { ... } // marks provided setter private</div><div>}</div><div><br></div><div>var foo: Int { // marks provided getter and setter module scoped however...</div><div> get { ... } // not specified, inherit access level module scoped</div><div> private set { ... } // marks provided setter private</div><div>}</div><div><br></div><div>private(module) var foo: Int { // marks provided getter and setter module scoped however...</div><div> get { ... } // not specified, inherit access level module scoped</div><div> private(file) set { ... } // marks provided setter file scoped</div><div>}</div><div><br></div><div>var foo: Int { // marks provided getter and setter module scoped however...</div><div> private(file) get { ... } // not specified, inherit access level module scoped</div><div> private set { ... } // marks provided setter file scoped</div><div>}</div><div><br></div><div>...etc...</div><div><br></div><div>public subscript(index: Int) -> Int { ... } // marks provided getter public, read-only</div><div><br></div><div>public subscript(index: Int) -> Int { // marks provided getter and setter public</div><div> get { ... } // not specified, inherit access level public</div><div> set { ... } // not specified, inherit access level public</div><div>}</div><div><br></div><div>public subscript(index: Int) -> Int { // marks provided getter and setter public however...</div><div> get { ... } // not specified, inherit access level public</div><div> private set { ... } // marks provided setter private</div><div>}</div><div><br></div><div>subscript(index: Int) -> Int { // marks provided getter and setter module scoped however...</div><div> get { ... } // not specified, inherit access level module scoped</div><div> private set { ... } // marks provided setter private</div><div>}</div><div><br></div><div>subscript(index: Int) -> Int { // marks provided getter and setter module scoped however...</div><div> public get { ... } // marks provided getter public</div><div> private set { ... } // marks provided setter private</div><div>}</div><div><br></div><div>subscript(index: Int) -> Int { // marks provided getter and setter module scoped however...</div><div> public get { ... } // marks provided getter public</div><div> private(file) set { ... } // marks provided setter file scoped</div><div>}</div><div>...etc...</div></span> <br></div></div></div>