<div dir="ltr">Thoughts:<div>Here are the first two ideas I had regarding generic 'access' symbols.</div><div><br></div><div><div>"public" -> symbol visible outside the current module</div><div>"internal" -> symbol visible within the current module</div><div>"restricted" -> symbol visible within the current file</div><div>"private" -> symbol visible within the current declaration</div></div><div><br></div><div>"public" -> symbol visible outside the current module</div><div>"internal" -> symbol visible within the current module</div><div>"private" -> symbol visible within the current file</div><div>"intimate" -> symbol visible within the current declaration</div><div><br></div><div>However, I think if we're going to be 'Swift' about this, the terminology should be more explicit about what the access level refers to, rather than where it ranks on the accessibility scale. So, I'd prefer to see something like:</div><div>"publicaccess" -> symbol visible outside the current module</div><div>"moduleaccess" -> symbol visible within the current module</div><div>"fileaccess" -> symbol visible within the current file</div><div>"declarationaccess" -> symbol visible within the current declaration</div><div><br></div><div>("private(module)", "private(file)", "private(declaration)" etc. works for me too.)</div><div><br></div><div>This is clear. A "fileaccess" property can't be accessed outside its file, there's on wondering about whether one term is subjectively more or less restrictive than another term on the scale, and there's still room to expand this to include "submodule" or C#-like "region" scopes if those are desired future directions.</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 15, 2016 at 10:43 AM, Thorsten Seitz via swift-evolution <span dir="ltr"><<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div>+1 for your proposed changes to private(set) etc.<br></div><div><br></div><div>-Thorsten<br></div><div><br></div><div><br>Am 15. März 2016 um 05:38 schrieb Shawn Erickson via swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>>:<br><br><div><blockquote type="cite"><div><div dir="ltr"><br><br><div class="gmail_quote"><span class=""><div dir="ltr">On Mon, Mar 14, 2016 at 5:18 PM Chris Lattner via swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 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></span><div><div class="h5"><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></div></div><span class=""><div><span>_______________________________________________<br>swift-evolution mailing list<br><a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br></span></div></span></div></blockquote></div></div></div><br>_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
<br></blockquote></div><br></div>