<div dir="ltr">A new type is implicitly internal to a module. Implicitly specifying it as &#39;external&#39; is just plain confusing.</div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Apr 1, 2016 at 3:01 PM, Sean Heber via swift-evolution <span dir="ltr">&lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I know this is kind of winding down, and there seems to be a kind of begrudging acceptance of “fileprivate” emerging (perhaps due to fatigue), but I still really don’t like it so I’m going to toss out my current favorite configuration and try to stop caring and defer to the core team to make an executive decision so we can all move on with our lives. :P<br>
<br>
public - unchanged, visible “everywhere&quot;<br>
external - visible outside of the file (module, the default)<br>
internal - visible only within the file<br>
private - visible only within the scope<br>
<br>
I really like the existing private and I use it a lot to build collections of small classes and structs that work together rather than a large class/struct that tries to “be everything”. In those scenarios, traditional OO private would be too restrictive and even a “protected” access type wouldn’t work because I’m trying to avoid building inheritance hierarchies. I really need something like “friend” (ugly) or the, imo, much more elegant file-scoped access and if that one is renamed “fileprivate” I’ll be really sad seeing such an ugly label all over the place. I’d go so far as to suggest that an ugly name for this access level would actively discourage its use and while some might have that as a goal, to me that would encourage the creation of larger “do everything” classes instead of clusters of smaller classes and structs and protocols.<br>
<br>
l8r<br>
Sean<br>
<div class="HOEnZb"><div class="h5"><br>
&gt; On Apr 1, 2016, at 7:17 AM, Joanna Carter via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>&gt; wrote:<br>
&gt;<br>
&gt;&gt; I’ve seen a number of concerns on this list about moduleprivate, and how it penalizes folks who want to explicitly write their access control.  I’ve come to think that there is yes-another possible path forward here (which I haven’t seen mentioned so far):<br>
&gt;&gt;<br>
&gt;&gt; public<br>
&gt;&gt; internal<br>
&gt;&gt; fileprivate<br>
&gt;&gt; private<br>
&gt;&gt;<br>
&gt;&gt; The advantages, as I see them are:<br>
&gt;&gt; 1) We keep public and private meaning the “right” and “obvious” things.<br>
&gt;&gt; 2) The declmodifiers “read” correctly.<br>
&gt;&gt; 3) Compared to Swift 2, there is almost no change.  The only thing that changes is that some uses of Swift 2 “private” will be migrated to “fileprivate”, which makes the intent of the code much more clear.<br>
&gt;&gt; 4) fileprivate is the unusual and not-really-precedented-in-other-languages modifier, and it would still be “googable”.<br>
&gt;&gt; 5) The addresses the “excessively long” declmodifier problem that several people are concerned with.<br>
&gt;&gt; 6) Support for named submodules could be “dropped in” by parameterizing “internal”.<br>
&gt;&gt;<br>
&gt;&gt; Thoughts?<br>
&gt;<br>
&gt; +1<br>
&gt;<br>
&gt; Following on from my experience with Delphi adding &quot;strict private&quot; for &quot;OO private&quot; members of classes, I would totally agree with your proposition.<br>
&gt;<br>
&gt; Having to use Delphi&#39;s &quot;strict private&quot; never really felt right to those of us who were brought up on the OO concept of private, and having &quot;private&quot; mean file scope simply encouraged very bad, large, files with lots of classes; especially for those who were new to programming.<br>
&gt;<br>
&gt; This proposal means that folks coming from other OO languages will instantly understand &quot;private&quot;; &quot;fileprivate&quot; does what it says on the tin.<br>
&gt;<br>
&gt; To my mind, the only extra scope that might be useful is the OO concept of &quot;protected&quot; on a class, but I would like to see a discussion purely centred on the effect of more protocols and less class inheritance, with its attendant impact on whether protected could also suit extending (otherwise private) scope to extensions.<br>
&gt;<br>
&gt; In recent experiments of adapting the GOF Design Patterns to Swift, I have found using protocols and extensions to greatly reduce the need for class inheritance, if not removing the need for classes at all in favour of structs.<br>
&gt;<br>
&gt; Joanna<br>
&gt;<br>
&gt; --<br>
&gt; Joanna Carter<br>
&gt; Carter Consulting<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; swift-evolution mailing list<br>
&gt; <a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a><br>
&gt; <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>
_______________________________________________<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>
</div></div></blockquote></div><br></div>