<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>What does that even mean fileprivate in a namespace? Does it become exposed outside the namespace? <span style="background-color: rgba(255, 255, 255, 0);">Not so private anymore. </span>Now we have this namespaceprivate thing too? Since a namespace could span multiple files. Getting very confusing quickly.&nbsp;</div><div id="AppleMailSignature"><br></div><div id="AppleMailSignature">&nbsp;If it is just "internal", it means within the scope of the namespace. &nbsp;If there is no namespace internal means internal to the file. I don't want to design &nbsp;namespaces here though, just keep a path to context helping with it and not have to redo all the access levels down the road.&nbsp;</div><div id="AppleMailSignature"><br></div><div id="AppleMailSignature">These levels would stay consistent within the scope in which they are defined.&nbsp;</div><div id="AppleMailSignature"><br>- Paul&nbsp;</div><div id="AppleMailSignature"><br>Sent from my iPhone</div><div><br>On Mar 29, 2016, at 8:13 AM, Ross O'Brien &lt;<a href="mailto:narrativium+swift@gmail.com">narrativium+swift@gmail.com</a>&gt; wrote:<br><br></div><blockquote type="cite"><div><div dir="ltr"><div>If 'knowing from the context that it only applies to a certain scope' is really that helpful, then let's make it as simple as we can: 'firstprivate', 'secondprivate', 'thirdprivate', 'fourthprivate'. That's an easily extensible system: if we need a new level, we add 'fifthprivate'. Then we re-learn the context of each one.</div><div><br></div><div>I don't see that as advantageous.</div><div><br></div><div>This is the advantage of 'moduleprivate' and 'fileprivate' is to me: the definitions of 'module' and 'file' will not change. I know where the visibility of these symbols ends, just by reading it. I don't need to consult the new Swift X contextual scale. I don't have to relearn it if we add a new level. If we add 'namespaceprivate' then it is immediately clear that any symbol so marked is visible within a namespace and if it isn't immediately clear then my first documentation search will be for 'Swift namespace' and not something like 'Swift restricted' followed by 'Swift namespace'. We bake this objective information into the keyword itself, information which is simply not present in terms like 'private' or 'local' or 'secret', and we become more confident knowing that the definition of 'file' won't change between versions, and that makes our code easier to maintain.</div><div><br></div><div>I have enough new things to learn as Swift evolves. Disambiguating 'typealias' into 'typealias' and 'associatedtype' was a new thing to learn which improved Swift's clarity. Renaming 'private' as 'internal' does not improve clarity.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 29, 2016 at 3:24 PM, Paul Ossenbruggen <span dir="ltr">&lt;<a href="mailto:possen@gmail.com" target="_blank">possen@gmail.com</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"><div>Just as context is used for variable names does not need a specific scoping specifier every time one is declared.&nbsp; You know from the context in which it is used that it only applies to a certain scope.&nbsp;</div><div><div><br></div><div><div>I would hope that if namespaces are added we would not have namespaceprivate etc The keywords would explode and become quite confusing..Instead if it is in a namespace you would use internal or external and the scope changes to the namespace rather than the file but as I said this is beyond the intent of this proposal.&nbsp;</div><div><div class="h5"><div><br><div><blockquote type="cite"><div>On Mar 29, 2016, at 7:04 AM, Ross O'Brien &lt;<a href="mailto:narrativium+swift@gmail.com" target="_blank">narrativium+swift@gmail.com</a>&gt; wrote:</div><br><div><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 'internal' scope, that the meaning of 'internal' should be subject to change in future versions of Swift? 'Once you know its meaning' should mean once!</div><div><br></div><div>Right now, I use the word 'private' 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 'internal' to replace 'private' may make that process even more complicated... but okay, it's a one-time cost.</div><div><br></div><div>I don't see the advantage in knowing that adding another visibility level in future will require another intensive review. I'd prefer it if a keyword was explicit about its meaning. Migration can then be straightforward: everything 'private' now can become 'file-private', 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't break just because 'private' 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><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.&nbsp;</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.&nbsp;</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.&nbsp; 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&nbsp;</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" target="_blank">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>
</div></blockquote></div><br></div></div></div></div></div></div></blockquote></div><br></div>
</div></blockquote></body></html>