<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div></div><div>Internal is the right choice here. If it gives too much access then you might consider pulling this code into a separate module.</div><div><br></div><div>If “private” gave access to every extension then any code outside your module could make a new extension and access that method. That would make it effectively public in that you wouldn’t have any ability to limit who can call it.</div><div><br>On Oct 29, 2017, at 7:37 AM, Mike Kluev via swift-evolution <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> wrote:<br><br></div><blockquote type="cite"><div><div dir="ltr">i am missing some protection level, which can be called "classprivate" or "structprivate" / "enumprivate" (names could be better). here is an example:<div><br></div><div>--- file Some.swift ---</div><div><p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Helvetica;min-height:14px"><br></p>
<p style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="color:rgb(4,51,255)">class</span> Some {</p>
<p style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(4,51,255)"><span style="color:rgb(0,0,0)"><span class="gmail-Apple-tab-span" style="white-space:pre">        </span></span>private<span style="color:rgb(0,0,0)"> </span>func<span style="color:rgb(0,0,0)"> foo() {</span></p>
<p style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,143,0)"><span style="color:rgb(0,0,0)"><span class="gmail-Apple-tab-span" style="white-space:pre">                </span></span><span style="text-decoration:underline;color:rgb(0,0,0)">b</span><span style="color:rgb(0,0,0)">ar() </span>// error: inaccessible due to 'private'</p>
<p style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span class="gmail-Apple-tab-span" style="white-space:pre">        </span>}</p>
<p style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">}</p></div><div><br></div><div><div>--- file Some+Bar.swift ---</div></div><div><br></div><div><p style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(4,51,255)">extension<span style="color:rgb(0,0,0)"> </span><span style="color:rgb(52,149,175)">Some</span><span style="color:rgb(0,0,0)"> {</span></p>
<p style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(4,51,255)"><span style="color:rgb(0,0,0)"><span class="gmail-Apple-tab-span" style="white-space:pre">        </span></span>private<span style="color:rgb(0,0,0)"> </span>func<span style="color:rgb(0,0,0)"> bar() {</span></p>
<p style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,143,0)"><span style="color:rgb(0,0,0)"><span class="gmail-Apple-tab-span" style="white-space:pre">                </span></span><span style="text-decoration:underline;color:rgb(0,0,0)">f</span><span style="color:rgb(0,0,0)">oo() </span>// error: inaccessible due to 'private'</p>
<p style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span class="gmail-Apple-tab-span" style="white-space:pre">        </span>}</p>
<p style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">}</p></div><div><br></div><div>1) i want to have this extension in a different file (to keep file sizes manageable).</div><div><br></div><div>2) i can't use either private or fileprivate due to compilation errors</div><div><br></div><div>3) i do not want to have neither "foo" nor "bar" public</div><div><br></div><div>4) "internal" doesn't help as "foo" and "bar" will be available to my app (which is unwanted).</div><div><br></div><div>is there some "classprivate" to help here? if not so far, shall there be one? opinions?</div><div><br></div><div>Mike</div><div><br></div></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>