<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>Access levels are not a security mechanism. You have to trust your (fellow) programmers. Lots of good software has been created in Smalltalk and other languages without "private" access levels.<br><br><span style="background-color: rgba(255, 255, 255, 0);">--<br>C. Keith Ray</span><div><span style="background-color: rgba(255, 255, 255, 0);"><br></span></div><div><span style="background-color: rgba(255, 255, 255, 0);">* <a href="https://leanpub.com/wepntk">https://leanpub.com/wepntk</a> <- buy my book?<br>* </span><a href="http://www.thirdfoundationsw.com/keith_ray_resume_2014_long.pdf">http://www.thirdfoundationsw.com/keith_ray_resume_2014_long.pdf</a><span style="background-color: rgba(255, 255, 255, 0);"><br>* <a href="http://agilesolutionspace.blogspot.com/">http://agilesolutionspace.blogspot.com/</a></span></div></div><div><br>On Oct 30, 2017, at 5:34 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">On 30 October 2017 at 07:30, Adam Kemp <span dir="ltr"><<a href="mailto:adam.kemp@apple.com" target="_blank">adam.kemp@apple.com</a>></span> wrote:<div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="auto"><span class="gmail-"><br></span><div>No. There are two reasonable options:</div><div><br></div><div>1. Make it public. If it’s needed outside the module then this is an accurate description of its access level. </div><div><br></div><div>2. Make it internal and accept that any code in the same module can access it. Again, that is effectively what your proposed scope allows anyway so internal is an accurate description of its actual access level. Call it what it is.</div><div><br></div></div></blockquote><div><br></div><div>Adam, i fail to see why you say "No" to "one module per class approach" if the goal is to make the individual multi-file classes as isolated as possible (i.e. not see each other "internal" stuff). which (this goal) is considered the "way to go" approach in other languages and the "default" behaviour.</div><div><br></div><div>this:</div><div><br></div><div>SingleFileClass1.swift // with bunch of "privates" inside</div><div><br></div><div><div>SingleFileClass2.swift // with bunch of "privates" inside</div><div><br></div></div><div><div>SingleFileClass3.swift // with bunch of "privates" inside</div></div><div><br></div><div>is equivalent to this:</div><div><br></div><div>Module solely for Class1</div><div> Class1.swift // with bunch of "internals inside</div><div> Class1+Extension.swift // with bunch of "internals" inside</div><div> </div><div>Module solely for Class2</div><div><div> Class2.swift // with bunch of "internals" inside</div><div> Class2+Extension.swift // with bunch of "internals" inside </div></div><div><br></div><div><div>Module solely for Class3</div><div> Class3.swift // with bunch of "internals" inside</div><div> Class3+Extension.swift // with bunch of "internals" inside</div><div> </div></div><div><br></div><div>still "no" ?</div><div><br></div><div>i mean, it's fine (although a bit odd) that a mere change from a single-file to a multi-file class leads to such drastic consequences. different to what i saw before. but I can adapt of course.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="auto"><div></div><div>Either way the answer is basically the same: don’t obfuscate the effective access level and pretend you’re being strict when you’re really not. It’s like putting a lock on the door with the key hanging from the doorknob. You may as well just keep it unlocked. </div><span class="gmail-"><div><br></div></span></div></blockquote><div><br></div><div>nice analogy :-)</div><div><br></div><div>Mike<br></div><div><br></div></div></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>