<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">How about private(world), public(module), internal(file)? :-)<div class=""><br class=""></div><div class="">Slava</div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Mar 25, 2017, at 4:15 PM, Adrian Zubarev via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">Please do not start a debate about `private(module)` which is equavalent to `internal`, otherwise you could equally use a parametrized `public` for everything.&nbsp;<div class=""><br class=""></div><div class="">public(outside_module), public(only_inside_module), public(only_in_this_file) or public(nowhere)</div><div class=""><br class=""></div><div class="">`internal` is just fine as it is.<br class=""> <br class=""><div class="bloop_sign"><div style="font-family:helvetica,arial;font-size:13px" class="">--&nbsp;<br class="">Adrian Zubarev<br class="">Sent with Airmail</div></div><p class="gmail_quote" style="">Am 25. März 2017 um 16:43:23, Matt Whiteside via swift-evolution (<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>) schrieb:</p> <blockquote type="cite" class="gmail_quote"><span class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""></div><div class="">



<title class=""></title>


<br class="">
<div class="">
<blockquote type="cite" class="">
<div class="">On Mar 23, 2017, at 18:35, Matthew Johnson via
swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div>
<div class="">
<div dir="auto" class="">
<div class=""><br class="">
On Mar 23, 2017, at 8:27 PM, Drew Crawford &lt;<a href="mailto:drew@sealedabstract.com" class="">drew@sealedabstract.com</a>&gt; wrote:<br class="">
<br class=""></div>
<blockquote type="cite" class="">
<div class="">

<div class=""><br class=""></div>
<div class="">The obvious example would be Rust. &nbsp;Rust has
exactly two visibilities, and merely one keyword. &nbsp;By default,
members are "private" which is visible inside the module (so, like
Swift's internal). The "public" keyword is similar to
Swift.&nbsp;</div>
<div class=""><br class=""></div>
<div class="">The reason this works is that unlike in Swift where a
module is something like a library or framework (Rust calls those
"crates"), in Rust modules in are (explicitly) lexically scoped; a
"mod myscope {}" module can be created for the portion of the file
for which the member should be visible and it won't be visible
outside that scope. Likewise, "fileprivate" can be achieved by
enclosing the file in a "mod MyFile {}". And like all lexical
scopes, they can be recursively nested to arbitrary depth to
achieve any number of visibility behaviors (e.g., declare a module
for the first half of two files) that would require complex new
keywords to achieve in Swift. <span style="background-color: rgba(255, 255, 255, 0);" class="">Finally there
are some shortcut features like the ability to infer a module
structure from the file system.&nbsp;</span></div>
</div>
</blockquote>
<div class=""><br class=""></div>
This is a good example of what I meant. &nbsp;There is an extremely
broad range of possible designs for submodules. &nbsp;Some of them,
such as this example, would make it relatively easy to get by
without fileprivate. &nbsp;There are also many other possible
designs that would not. &nbsp;</div>
</div>
</blockquote>
<br class=""></div>
<div class="">The Rust approach sounds ideal to me. &nbsp;I hope Swift can
get to this point some day.</div>
<div class=""><br class=""></div>
<div class="">But as for the current proposal, I’ve become convinced that it
would cause headaches for too many people. &nbsp;Parametrizing the
private keyword seems a compromise between pragmatism and
elegance:</div>
<div class=""><br class=""></div>
<div class="">public</div>
<div class="">private(module)</div>
<div class="">private(file)</div>
<div class="">private(scope)</div>
<div class=""><br class=""></div>
<div class="">-Matt</div>


_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></div></span></blockquote>

</div></div>_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></blockquote></div><br class=""></div></body></html>