<div dir="ltr">How is flexibility desirable?<div><div><br><div>Why is it important to me, if I decide that a given class should only be visible at &#39;internal&#39; scope, that the meaning of &#39;internal&#39; should be subject to change in future versions of Swift? &#39;Once you know its meaning&#39; should mean once!</div><div><br></div><div>Right now, I use the word &#39;private&#39; when I want code to be only visible within a file. When I migrate a project to Swift 3, an automatic migrator may not be able to tell whether a given private property should now be scope-private or file-private. Perhaps we can assume that anything private referred to in more than one scope should be file-private and everything remaining should be scope-private, but I think it would still be wise to manually review the changes. Using &#39;internal&#39; to replace &#39;private&#39; may make that process even more complicated... but okay, it&#39;s a one-time cost.</div><div><br></div><div>I don&#39;t see the advantage in knowing that adding another visibility level in future will require another intensive review. I&#39;d prefer it if a keyword was explicit about its meaning. Migration can then be straightforward: everything &#39;private&#39; now can become &#39;file-private&#39;, and if I want to reduce the visibility of anything to scope-private then I can do so manually. If we add an even more private level in future then the code doesn&#39;t break just because &#39;private&#39; was too subjective in its meaning.</div><div><br></div><div><br></div></div><div><br></div><div><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 29, 2016 at 2:23 PM, Paul Ossenbruggen 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"><div style="word-wrap:break-word"><span class=""><br><div><blockquote type="cite"><div>On Mar 29, 2016, at 12:32 AM, Andrey Tarantsov via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt; wrote:</div><br><div><div style="word-wrap:break-word"><div><div><div><blockquote type="cite" style="font-family:Helvetica;font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div>public (unchanged)</div><div>external (module access)</div><div>internal (file access)</div><div>private (scoped access)</div></blockquote></div><div><div><br></div></div><div>This seems logical and something I could live with, but how is it better than moduleprivate and fileprivate? Also, internal has contradictory prior art in C# and Swift 2 (not that it stops us).</div><div><br></div><div>And I see the length of moduleprivate and fileprivate as a feature, and external/internal lacks it.</div></div></div></div></div></blockquote></div><div><br></div></span><div>It is better than moduleprivate and fileprivate in that it is a single word which is easier to to read and there is less typing. Less typing even with autocomplete is a benefit. Once you know its meaning, that both are relative to file access, you won’t have to look it up. Also, just noticed this, when I type multiword keywords in an email program or chat program autocorrect butts in. This is of practical value because much work is done in chat and email programs. </div><div><br></div><div>Simpler is better if it sufficiently conveys the meaning and it does in this case. The expectation with most keywords are that they be single words, especially ones that are used the most. </div><div><br></div><div>There is a nice symmetry to internal/external and public/private.</div><div><br></div><div>If external/internal refer to the file, then we don’t need the multiword descriptive versions.  Also, if we decide later that scoping to namespaces is desired these same already reserved keywords give us more flexibility than the more specific keywords would allow. Internal/external could refer to the namespace scope rather than the file scope if it is inside a namespace (this is beyond the scope of the proposal but trying to think ahead). By not explicitly stating the scope you gain flexibility </div><div><br></div><div>- Paul</div><div><br></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>