<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div></div><div>I know it was suggested that it be the subject of a different thread, but it might be good to clarify how the new private is going to work (or at least what is currently envisioned).</div><div><br></div><div>My understanding is that the new private would be:&nbsp;</div><div>- visible only to the immediately enclosing scope</div><div>- including the scope of a inner nested scope</div><div>- not including the scope of an outer nested scope</div><div>- not visible to an extension&nbsp;</div><div><br></div><div>Said in code (all in the same file):</div><div>----------</div><div>class Outer { // Outer visible to module</div><div>&nbsp; &nbsp; private var a: Int // visible to Outer, Inner1, &amp; Inner2</div><div><br></div><div>&nbsp; &nbsp; class Inner1 { // Inner1 visible to module</div><div>&nbsp; &nbsp; &nbsp; &nbsp; private var b: Int // visible to Inner1 only</div><div>&nbsp; &nbsp; }</div><div>&nbsp; &nbsp; private class Inner2 { // visible to Outer &amp; Inner(s)</div><div>&nbsp; &nbsp; &nbsp; &nbsp; var c: Int // visible to Outer &amp; Inner(s)</div><div>&nbsp; &nbsp; }</div><div>}</div><div><br></div><div>extension Outer { // visible to module</div><div>&nbsp; &nbsp; // 'a', 'b', and 'Inner2' NOT visible</div><div>}</div><div>----------</div><div>If this is the intended meaning of private, then fileprivate seems to be the same as private (private to the enclosing scope... which happens to be the file).</div><div><br></div><div>Something declared "private" at the top level of a file is fileprivate. There would still need to be a way to reference scopes other than the immediate one (especially since there is no way to say "private" and mean moduleprivate), though I think it would strengthen the argument for something along the lines of "private(file)", since it would even further reduce the cases where you are spelling something more than just "private"</div><div><br></div><div><br>On Mar 27, 2016, at 17:31, Haravikk via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>&gt; wrote:<br><br></div><blockquote type="cite"><div><meta http-equiv="Content-Type" content="text/html charset=utf-8"><br class=""><div class=""><div><blockquote type="cite" class=""><div class="">On 27 Mar 2016, at 19:34, Jose Cheyo Jimenez via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><div class=""><div dir="auto" class=""><div class=""><br class=""></div><div class="">Public&nbsp;</div><div class="">External (default)</div><div class="">Internal</div><div class="">Private</div></div></div></blockquote><br class=""></div><div>I still feel like these are still too vague; I’m not sure I like the use of external, as public to me is external since it exports outside of the module, whereas what you’re proposing is in fact just limited to the module itself. I dislike the current internal keyword too, but at least it reads as “internal to this module", this is why the more specific terms are better like:</div></div><div><br class=""></div><div><font face="Monaco" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>public<span class="Apple-tab-span" style="white-space:pre">                                </span>as-is, item is public/exported outside of module</font></div><div><font face="Monaco" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>private(module) or private<span class="Apple-tab-span" style="white-space:pre">        </span>current internal, item is private to this module, would be the default</font></div><div><font face="Monaco" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>private(file)<span class="Apple-tab-span" style="white-space:pre">                        </span>current private, item is private to this file</font></div><div><font face="Monaco" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>private(scope)<span class="Apple-tab-span" style="white-space:pre">                        </span>new visibility type, item is private to the current scope</font></div><div><br class=""></div><div>Assuming I’m understanding the restriction properly this time =)</div><div><br class=""></div><div>It’s also the easiest method if we do add another visibility later for sub-classes such as private(type), as it doesn’t even require a new keyword.</div></div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>swift-evolution mailing list</span><br><span><a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a></span><br><span><a href="https://lists.swift.org/mailman/listinfo/swift-evolution">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br></div></blockquote></body></html>