<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Jul 18, 2016 at 4:49 PM, Robert Widmann <span dir="ltr">&lt;<a href="mailto:rwidmann@apple.com" target="_blank">rwidmann@apple.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"><br><div><span class=""><blockquote type="cite"><div>On Jul 18, 2016, at 2:32 PM, Xiaodi Wu &lt;<a href="mailto:xiaodi.wu@gmail.com" target="_blank">xiaodi.wu@gmail.com</a>&gt; wrote:</div><br><div>This is an interesting document. I think it deserves careful study. For now, some questions:<br><br>What is the rationale behind permitting the using of specific methods? This seems to be usually fine-grained in comparison to other languages. What use cases do you have in mind for this?<br><br></div></blockquote><div><br></div></span><div>One use case: Swift libraries export not just member references as I’ve used here, but a large amount of free functions.  It has long been a problem that free functions seem to pollute a shared namespace and there didn’t seem to be a clear way to hide them.</div></div></div></blockquote><div><br></div><div>Would a plausible simplification of the proposal be to have it fine-grained enough to address free functions but not methods inside types?</div><div>Incidentally, although I do not see it in the proposal, I assume that * in some form will be permitted (as in, `import Foundation using *`).</div><div><br></div><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><span class=""><br><blockquote type="cite"><div>I can see the use case for hiding specific symbols when they come into conflict with your own, but in your example you&#39;re hiding specific methods declared *in* an imported type. What is the use case here? Is it going to allow me to open backdoors so that, if I don&#39;t like `Foo.frobnicate()`, I can hide it and then substitute my own in an extension? This seems like a bad thing at first blush.<br></div></blockquote><div><br></div></span><div>For members that would be an acceptable use-case.  The worst-case scenario that comes to mind is this being used as a way to “virtually override” a method in a subclass.  Then again, the scope of the damage is limited to the file in which you’ve declared this monstrosity so clients and even you will not be able to see it outside of there unless you explicitly redeclare the hiding import (in which case, you probably know what you’re doing).</div><div><br></div><div>A use care here might be hiding the KVO-ish parts of an object from yourself, or more generally subsetting out the part of an API you know you shouldn’t interact with in a particular submodule.</div><span class=""><br><blockquote type="cite"><div><br>I can see the obvious use case for renaming modules and types on import--basically, in my mind, it&#39;s like typealiases with hiding, and it&#39;s available in other languages of course. But how would renaming methods work? If Foo conforms to Equatable and I rename `Foo.==` to `Foo.!=`, is the type I import still Equatable? How would it behave? And even if Foo is fine, what happens if I try to subclass my Frankensteinian Foo?<br></div></blockquote><div><br></div></span><div>Of course you still conform to Equatable.  The renaming defines a mapping from your names to “proper&quot; names.  For example, if you use a renaming import to change the requirements of a protocol in a file, then your conformance will simply look at the mapping and see that everything resolves into its proper place.  Bear in mind that your renamings will not survive outside of the file in which you declare them.  Frankenteinian Foo exists where you say it does and nowhere else.  Everybody else just sees Foo conform to Equatable (unless they rename things themselves).</div></div></div></blockquote><div><br></div><div>Maybe let&#39;s work through an example:</div><div><br></div><div>Suppose we have in stdlib:</div><div><br></div><div>```</div><div>public protocol FooProtocol {</div><div>  func frobnicate()</div><div>}</div><div>```</div><div><br></div><div>Now, I write a library:</div><div><br></div><div>```</div><div>import Swift.FooProtocol renaming (FooProtocol.frobnicate(), to: FooProtocol.bobnicate())</div><div><br></div><div>public open class MyFoo : Swift.FooProtocol {</div><div>  public open func bobnicate() {</div><div>    print(&quot;Does your head hurt yet?&quot;)</div><div>  }</div><div>}</div><div>```</div><div><br></div><div>Now, you are an end user of my sinister library.</div><div><br></div><div>What is the public API of `MyFoo`?</div><div>For you, does `MyFoo` conform to `Swift.FooProtocol`?</div><div>Can you call `MyFoo.frobnicate()`? How about `MyFoo.bobnicate()`?</div><div><br></div><div>What if you try to subclass `MyFoo`?<br></div><div>Does your subclass still conform to `Swift.FooProtocol`?</div><div>Do you override `bobnicate()` or `frobnicate()`?</div><div>My head hurts...</div><div> </div><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><div><div class="h5"><br><blockquote type="cite"><div><br><div class="gmail_quote"><div dir="ltr">On Mon, Jul 18, 2016 at 16:10 Robert Widmann via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Hello all,<div><br></div><div>TJ Usiyan, Harlan Haskins, and I have been working on a proposal to rework qualified imports and introduce an explicit module system to Swift that we’d like to publish for your viewing pleasure.</div><div><br></div><div>The initial impetus was set out in a radar (<a>rdar://17630570</a>) I sent fairly early on that didn’t receive a response, so I started a <a href="http://permalink.gmane.org/gmane.comp.lang.swift.evolution/1378" target="_blank">swift-evolution</a> thread discussing the basics of this proposal.  It has been refined and expanded a bit to include an effort to make Swift modules explicit and updated with the feedback of that first thread.  Contents of the proposal are inline and <a href="https://gist.github.com/CodaFi/42e5e5e94d857547abc381d9a9d0afd6" target="_blank">can also be had as a gist</a> or <a href="https://github.com/apple/swift-evolution/pull/440" target="_blank">on Github.</a></div><div><br></div><div>Cheers,</div><div><br></div><div>~Robert Widmann</div><div><br></div><div><h1 style="margin-right:0px;margin-bottom:16px;margin-left:0px;line-height:1.25;padding-bottom:0.3em;border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:rgb(238,238,238);color:rgb(51,51,51);font-family:-apple-system,BlinkMacSystemFont,&#39;Segoe UI&#39;,Roboto,Helvetica,Arial,sans-serif,&#39;Apple Color Emoji&#39;,&#39;Segoe UI Emoji&#39;,&#39;Segoe UI Symbol&#39;;background-color:rgb(255,255,255);margin-top:0px!important">Qualified Imports and Modules</h1><ul style="padding-left:2em;margin-top:0px;margin-bottom:16px;color:rgb(51,51,51);font-family:-apple-system,BlinkMacSystemFont,&#39;Segoe UI&#39;,Roboto,Helvetica,Arial,sans-serif,&#39;Apple Color Emoji&#39;,&#39;Segoe UI Emoji&#39;,&#39;Segoe UI Symbol&#39;;font-size:16px;background-color:rgb(255,255,255)"><li>Proposal: <a href="https://gist.github.com/CodaFi/NNNN-first-class-qualified-imports.md" style="background-color:transparent;color:rgb(64,120,192);text-decoration:none" target="_blank">SE-NNNN</a></li><li style="margin-top:0.25em">Authors: <a href="https://github.com/codafi" style="background-color:transparent;color:rgb(64,120,192);text-decoration:none" target="_blank">Robert Widmann</a>, <a href="https://github.com/harlanhaskins" style="background-color:transparent;color:rgb(64,120,192);text-decoration:none" target="_blank">Harlan Haskins</a>, <a href="https://github.com/griotspeak" style="background-color:transparent;color:rgb(64,120,192);text-decoration:none" target="_blank">TJ Usiyan</a></li><li style="margin-top:0.25em">Status: <span style="font-weight:600">Awaiting review</span></li><li style="margin-top:0.25em">Review manager: TBD</li></ul><h2 style="margin-top:24px;margin-bottom:16px;line-height:1.25;padding-bottom:0.3em;border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:rgb(238,238,238);color:rgb(51,51,51);font-family:-apple-system,BlinkMacSystemFont,&#39;Segoe UI&#39;,Roboto,Helvetica,Arial,sans-serif,&#39;Apple Color Emoji&#39;,&#39;Segoe UI Emoji&#39;,&#39;Segoe UI Symbol&#39;;background-color:rgb(255,255,255)"><a href="https://gist.github.com/CodaFi/42e5e5e94d857547abc381d9a9d0afd6#introduction" style="background-color:transparent;color:rgb(64,120,192);text-decoration:none;float:left;padding-right:4px;line-height:1" target="_blank"><u></u><u></u><u></u><u></u></a>Introduction</h2><p style="margin-top:0px;margin-bottom:16px;color:rgb(51,51,51);font-family:-apple-system,BlinkMacSystemFont,&#39;Segoe UI&#39;,Roboto,Helvetica,Arial,sans-serif,&#39;Apple Color Emoji&#39;,&#39;Segoe UI Emoji&#39;,&#39;Segoe UI Symbol&#39;;font-size:16px;background-color:rgb(255,255,255)">We propose a complete overhaul of the qualified imports syntax and semantics and the introduction of a module system.</p><h2 style="margin-top:24px;margin-bottom:16px;line-height:1.25;padding-bottom:0.3em;border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:rgb(238,238,238);color:rgb(51,51,51);font-family:-apple-system,BlinkMacSystemFont,&#39;Segoe UI&#39;,Roboto,Helvetica,Arial,sans-serif,&#39;Apple Color Emoji&#39;,&#39;Segoe UI Emoji&#39;,&#39;Segoe UI Symbol&#39;;background-color:rgb(255,255,255)"><a href="https://gist.github.com/CodaFi/42e5e5e94d857547abc381d9a9d0afd6#motivation" style="background-color:transparent;color:rgb(64,120,192);text-decoration:none;float:left;padding-right:4px;line-height:1" target="_blank"><u></u><u></u><u></u><u></u></a>Motivation</h2><p style="margin-top:0px;margin-bottom:16px;color:rgb(51,51,51);font-family:-apple-system,BlinkMacSystemFont,&#39;Segoe UI&#39;,Roboto,Helvetica,Arial,sans-serif,&#39;Apple Color Emoji&#39;,&#39;Segoe UI Emoji&#39;,&#39;Segoe UI Symbol&#39;;font-size:16px;background-color:rgb(255,255,255)">Swift code is modular by default. However, it is not clear how to decompose existing modules further into submodules. In addition, it is difficult to tell how importing a module affects its export to consumers of a library. This leads many to either fake namespaces with enums, attempt to structure Swift code with modulemaps, or use a large amount of version-control submodules. All of these can be rolled into one complete package in the form of a comprehensive rethink of the qualified import system and the introduction of a module system.</p><h2 style="margin-top:24px;margin-bottom:16px;line-height:1.25;padding-bottom:0.3em;border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:rgb(238,238,238);color:rgb(51,51,51);font-family:-apple-system,BlinkMacSystemFont,&#39;Segoe UI&#39;,Roboto,Helvetica,Arial,sans-serif,&#39;Apple Color Emoji&#39;,&#39;Segoe UI Emoji&#39;,&#39;Segoe UI Symbol&#39;;background-color:rgb(255,255,255)"><a href="https://gist.github.com/CodaFi/42e5e5e94d857547abc381d9a9d0afd6#proposed-solution" style="background-color:transparent;color:rgb(64,120,192);text-decoration:none;float:left;padding-right:4px;line-height:1" target="_blank"><u></u><u></u><u></u><u></u></a>Proposed solution</h2><p style="margin-top:0px;margin-bottom:16px;color:rgb(51,51,51);font-family:-apple-system,BlinkMacSystemFont,&#39;Segoe UI&#39;,Roboto,Helvetica,Arial,sans-serif,&#39;Apple Color Emoji&#39;,&#39;Segoe UI Emoji&#39;,&#39;Segoe UI Symbol&#39;;font-size:16px;background-color:rgb(255,255,255)">Modules will now become an explicit part of working with canonical Swift code. The grammar and semantics of qualified imports will change completely with the addition of <em>import qualifiers</em> and <em>import directives</em>. We also introduce three new contextual keywords: <code style="font-family:Consolas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;font-size:13.600000381469727px;padding:0.2em 0px;margin:0px;background-color:rgba(0,0,0,0.0392157);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">using</code>, <code style="font-family:Consolas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;font-size:13.600000381469727px;padding:0.2em 0px;margin:0px;background-color:rgba(0,0,0,0.0392157);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">hiding</code>, and <code style="font-family:Consolas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;font-size:13.600000381469727px;padding:0.2em 0px;margin:0px;background-color:rgba(0,0,0,0.0392157);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">renaming</code>, to facilitate fine-grained usage of module contents.</p><h2 style="margin-top:24px;margin-bottom:16px;line-height:1.25;padding-bottom:0.3em;border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:rgb(238,238,238);color:rgb(51,51,51);font-family:-apple-system,BlinkMacSystemFont,&#39;Segoe UI&#39;,Roboto,Helvetica,Arial,sans-serif,&#39;Apple Color Emoji&#39;,&#39;Segoe UI Emoji&#39;,&#39;Segoe UI Symbol&#39;;background-color:rgb(255,255,255)"><a href="https://gist.github.com/CodaFi/42e5e5e94d857547abc381d9a9d0afd6#detailed-design" style="background-color:transparent;color:rgb(64,120,192);text-decoration:none;float:left;padding-right:4px;line-height:1" target="_blank"><u></u><u></u><u></u><u></u></a>Detailed design</h2><p style="margin-top:0px;margin-bottom:16px;color:rgb(51,51,51);font-family:-apple-system,BlinkMacSystemFont,&#39;Segoe UI&#39;,Roboto,Helvetica,Arial,sans-serif,&#39;Apple Color Emoji&#39;,&#39;Segoe UI Emoji&#39;,&#39;Segoe UI Symbol&#39;;font-size:16px;background-color:rgb(255,255,255)">Qualified import syntax will be revised to the following</p><div style="margin-bottom:16px;color:rgb(51,51,51);font-family:-apple-system,BlinkMacSystemFont,&#39;Segoe UI&#39;,Roboto,Helvetica,Arial,sans-serif,&#39;Apple Color Emoji&#39;,&#39;Segoe UI Emoji&#39;,&#39;Segoe UI Symbol&#39;;font-size:16px;background-color:rgb(255,255,255)"><pre style="font-family:Consolas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;font-size:13.600000381469727px;margin-top:0px;margin-bottom:0px;line-height:1.45;word-wrap:normal;padding:16px;overflow:auto;background-color:rgb(247,247,247);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;word-break:normal">module-decl -&gt; module &lt;module-path&gt;
import-decl -&gt; &lt;access-level-modifier&gt; import &lt;module-path&gt; &lt;(opt) import-directive-list&gt;
module-path -&gt; &lt;identifier&gt;
            -&gt; &lt;identifier&gt;.&lt;import-path&gt;
import-directive-list -&gt; &lt;import-directive&gt;
                      -&gt; &lt;import-directive&gt; &lt;import-directive-list&gt;
import-directive -&gt; using (&lt;identifier&gt;, ...)
                 -&gt; hiding (&lt;identifier&gt;, ...)
                 -&gt; renaming (&lt;identifier&gt;, to: &lt;identifier&gt;, ...)</pre></div><p style="margin-top:0px;margin-bottom:16px;color:rgb(51,51,51);font-family:-apple-system,BlinkMacSystemFont,&#39;Segoe UI&#39;,Roboto,Helvetica,Arial,sans-serif,&#39;Apple Color Emoji&#39;,&#39;Segoe UI Emoji&#39;,&#39;Segoe UI Symbol&#39;;font-size:16px;background-color:rgb(255,255,255)">This introduces the concept of an import <em>directive</em>. An import directive is a file-local modification of an imported identifier. A directive can be one of 3 operations:</p><p style="margin-top:0px;margin-bottom:16px;color:rgb(51,51,51);font-family:-apple-system,BlinkMacSystemFont,&#39;Segoe UI&#39;,Roboto,Helvetica,Arial,sans-serif,&#39;Apple Color Emoji&#39;,&#39;Segoe UI Emoji&#39;,&#39;Segoe UI Symbol&#39;;font-size:16px;background-color:rgb(255,255,255)">1) <em>using</em>: The <em>using</em> directive is followed by a list of identifiers within the imported module that should be exposed to this file. </p><div style="margin-bottom:16px;color:rgb(51,51,51);font-family:-apple-system,BlinkMacSystemFont,&#39;Segoe UI&#39;,Roboto,Helvetica,Arial,sans-serif,&#39;Apple Color Emoji&#39;,&#39;Segoe UI Emoji&#39;,&#39;Segoe UI Symbol&#39;;font-size:16px;background-color:rgb(255,255,255)"><pre style="font-family:Consolas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;font-size:13.600000381469727px;margin-top:0px;margin-bottom:0px;line-height:1.45;word-wrap:normal;padding:16px;overflow:auto;background-color:rgb(247,247,247);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;word-break:normal"><span style="color:rgb(150,152,150)">// The only visible parts of Foundation in this file are </span>
<span style="color:rgb(150,152,150)">// Date.init(), Date.hashValue, and Date.description.</span>
<span style="color:rgb(167,29,93)">import</span> <span style="color:rgb(0,134,179)">Foundation.Date</span> using (Date<span style="color:rgb(167,29,93)">.</span><span style="color:rgb(167,29,93)">init</span>(), Date<span style="color:rgb(167,29,93)">.</span><span style="color:rgb(0,134,179)">hashValue</span>, Date<span style="color:rgb(167,29,93)">.</span><span style="color:rgb(0,134,179)">description</span>)</pre></div><p style="margin-top:0px;margin-bottom:16px;color:rgb(51,51,51);font-family:-apple-system,BlinkMacSystemFont,&#39;Segoe UI&#39;,Roboto,Helvetica,Arial,sans-serif,&#39;Apple Color Emoji&#39;,&#39;Segoe UI Emoji&#39;,&#39;Segoe UI Symbol&#39;;font-size:16px;background-color:rgb(255,255,255)">2) <em>hiding</em>: The <code style="font-family:Consolas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;font-size:13.600000381469727px;padding:0.2em 0px;margin:0px;background-color:rgba(0,0,0,0.0392157);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">hiding</code> directive is followed by a list of identifiers within the imported module that should be hidden from this file.</p><div style="margin-bottom:16px;color:rgb(51,51,51);font-family:-apple-system,BlinkMacSystemFont,&#39;Segoe UI&#39;,Roboto,Helvetica,Arial,sans-serif,&#39;Apple Color Emoji&#39;,&#39;Segoe UI Emoji&#39;,&#39;Segoe UI Symbol&#39;;font-size:16px;background-color:rgb(255,255,255)"><pre style="font-family:Consolas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;font-size:13.600000381469727px;margin-top:0px;margin-bottom:0px;line-height:1.45;word-wrap:normal;padding:16px;overflow:auto;background-color:rgb(247,247,247);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;word-break:normal"><span style="color:rgb(150,152,150)">// Imports all of Foundation.Date except `Date.compare()`</span>
<span style="color:rgb(167,29,93)">import</span> <span style="color:rgb(0,134,179)">Foundation.Date</span> hiding (Date<span style="color:rgb(167,29,93)">.</span>compare())</pre></div><p style="margin-top:0px;margin-bottom:16px;color:rgb(51,51,51);font-family:-apple-system,BlinkMacSystemFont,&#39;Segoe UI&#39;,Roboto,Helvetica,Arial,sans-serif,&#39;Apple Color Emoji&#39;,&#39;Segoe UI Emoji&#39;,&#39;Segoe UI Symbol&#39;;font-size:16px;background-color:rgb(255,255,255)">3) <em>renaming</em>: The <code style="font-family:Consolas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;font-size:13.600000381469727px;padding:0.2em 0px;margin:0px;background-color:rgba(0,0,0,0.0392157);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">renaming</code> directive is followed by a list of identifiers separated by <code style="font-family:Consolas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;font-size:13.600000381469727px;padding:0.2em 0px;margin:0px;background-color:rgba(0,0,0,0.0392157);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">to:</code> that should be exposed to this file but renamed. </p><div style="margin-bottom:16px;color:rgb(51,51,51);font-family:-apple-system,BlinkMacSystemFont,&#39;Segoe UI&#39;,Roboto,Helvetica,Arial,sans-serif,&#39;Apple Color Emoji&#39;,&#39;Segoe UI Emoji&#39;,&#39;Segoe UI Symbol&#39;;font-size:16px;background-color:rgb(255,255,255)"><pre style="font-family:Consolas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;font-size:13.600000381469727px;margin-top:0px;margin-bottom:0px;line-height:1.45;word-wrap:normal;padding:16px;overflow:auto;background-color:rgb(247,247,247);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;word-break:normal"><span style="color:rgb(150,152,150)">// Imports all of Dispatch.DispatchQueue but renames the static member </span>
<span style="color:rgb(150,152,150)">// DispatchQueue.main, to DispatchQueue.mainQueue</span>
<span style="color:rgb(167,29,93)">import</span> <span style="color:rgb(0,134,179)">Dispatch.DispatchQueue</span> renaming (DispatchQueue<span style="color:rgb(167,29,93)">.</span><span style="color:rgb(167,29,93)">Type</span><span style="color:rgb(167,29,93)">.</span>main to: DispatchQueue<span style="color:rgb(167,29,93)">.</span><span style="color:rgb(167,29,93)">Type</span><span style="color:rgb(167,29,93)">.</span>mainQueue)
<span style="color:rgb(150,152,150)">// Renaming can also rename modules.  All members of UIKit have to be qualified with</span>
<span style="color:rgb(150,152,150)">// `UI` now.</span>
<span style="color:rgb(167,29,93)">import</span> <span style="color:rgb(0,134,179)">UIKit</span> renaming (UIKit, to: UI)</pre></div><p style="margin-top:0px;margin-bottom:16px;color:rgb(51,51,51);font-family:-apple-system,BlinkMacSystemFont,&#39;Segoe UI&#39;,Roboto,Helvetica,Arial,sans-serif,&#39;Apple Color Emoji&#39;,&#39;Segoe UI Emoji&#39;,&#39;Segoe UI Symbol&#39;;font-size:16px;background-color:rgb(255,255,255)">Import directives chain to one another and can be used to create a fine-grained module import:</p><div style="margin-bottom:16px;color:rgb(51,51,51);font-family:-apple-system,BlinkMacSystemFont,&#39;Segoe UI&#39;,Roboto,Helvetica,Arial,sans-serif,&#39;Apple Color Emoji&#39;,&#39;Segoe UI Emoji&#39;,&#39;Segoe UI Symbol&#39;;font-size:16px;background-color:rgb(255,255,255)"><pre style="font-family:Consolas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;font-size:13.600000381469727px;margin-top:0px;margin-bottom:0px;line-height:1.45;word-wrap:normal;padding:16px;overflow:auto;background-color:rgb(247,247,247);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;word-break:normal"><span style="color:rgb(150,152,150)">// Imports all of Foundation except `DateFormatter` and renames `Cache` to `LRUCache`</span>
<span style="color:rgb(167,29,93)">import</span> <span style="color:rgb(0,134,179)">Foundation</span> hiding (DateFormatter) renaming (Cache to: LRUCache)
<span style="color:rgb(150,152,150)">// Imports SCNNode except SCNNode.init(mdlObject:) and renames `.description` to</span>
<span style="color:rgb(150,152,150)">// `.nodeDescription` </span>
<span style="color:rgb(167,29,93)">import</span> <span style="color:rgb(0,134,179)">SceneKit</span> using (SCNNode) 
                renaming (SCNNode<span style="color:rgb(167,29,93)">.</span><span style="color:rgb(0,134,179)">description</span>, to: SCNNode<span style="color:rgb(167,29,93)">.</span>nodeDescription)
                hiding (SCNNode<span style="color:rgb(167,29,93)">.</span><span style="color:rgb(167,29,93)">init</span>(mdlObject:))</pre></div><p style="margin-top:0px;margin-bottom:16px;color:rgb(51,51,51);font-family:-apple-system,BlinkMacSystemFont,&#39;Segoe UI&#39;,Roboto,Helvetica,Arial,sans-serif,&#39;Apple Color Emoji&#39;,&#39;Segoe UI Emoji&#39;,&#39;Segoe UI Symbol&#39;;font-size:16px;background-color:rgb(255,255,255)">Directive chaining occurs left-to-right:</p><div style="margin-bottom:16px;color:rgb(51,51,51);font-family:-apple-system,BlinkMacSystemFont,&#39;Segoe UI&#39;,Roboto,Helvetica,Arial,sans-serif,&#39;Apple Color Emoji&#39;,&#39;Segoe UI Emoji&#39;,&#39;Segoe UI Symbol&#39;;font-size:16px;background-color:rgb(255,255,255)"><pre style="font-family:Consolas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;font-size:13.600000381469727px;margin-top:0px;margin-bottom:0px;line-height:1.45;word-wrap:normal;padding:16px;overflow:auto;background-color:rgb(247,247,247);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;word-break:normal"><span style="color:rgb(150,152,150)">// This says to 1) Hide nothing 2) Use nothing 3) rename Int to INT.  It is invalid</span>
<span style="color:rgb(150,152,150)">// because 1) We will show everything 2) Then hide everything 3) Therefore Int is unavailable, error.</span>
<span style="color:rgb(167,29,93)">import</span> <span style="color:rgb(0,134,179)">Swift</span> hiding () using () renaming (<span style="color:rgb(0,134,179)">Int</span>, to: INT)
<span style="color:rgb(150,152,150)">// This says to 1) Use Int 2) Hide String 3) rename Double to Triple.  It is invalid</span>
<span style="color:rgb(150,152,150)">// because 1) Int is available 2) String is not, error. 3) Double is unavailable, error.</span>
<span style="color:rgb(167,29,93)">import</span> <span style="color:rgb(0,134,179)">Swift</span> using (<span style="color:rgb(0,134,179)">Int</span>) hiding (<span style="color:rgb(0,134,179)">String</span>) renaming (<span style="color:rgb(0,134,179)">Double</span>, to: Triple)
<span style="color:rgb(150,152,150)">// Valid.  This will be merged as `using (Int)`</span>
<span style="color:rgb(167,29,93)">import</span> <span style="color:rgb(0,134,179)">Swift</span> using () using (<span style="color:rgb(0,134,179)">Int</span>)
<span style="color:rgb(150,152,150)">// Valid.  This will be merged as `hiding (String, Double)`</span>
<span style="color:rgb(167,29,93)">import</span> <span style="color:rgb(0,134,179)">Swift</span> hiding (<span style="color:rgb(0,134,179)">String</span>) hiding (<span style="color:rgb(0,134,179)">Double</span>) hiding ()
<span style="color:rgb(150,152,150)">// Valid (if redundant). This will be merged as `using ()`</span>
<span style="color:rgb(167,29,93)">import</span> <span style="color:rgb(0,134,179)">Swift</span> using (<span style="color:rgb(0,134,179)">String</span>) hiding (<span style="color:rgb(0,134,179)">String</span>)</pre></div><p style="margin-top:0px;margin-bottom:16px;color:rgb(51,51,51);font-family:-apple-system,BlinkMacSystemFont,&#39;Segoe UI&#39;,Roboto,Helvetica,Arial,sans-serif,&#39;Apple Color Emoji&#39;,&#39;Segoe UI Emoji&#39;,&#39;Segoe UI Symbol&#39;;font-size:16px;background-color:rgb(255,255,255)">Module scope is delimited by the keyword <code style="font-family:Consolas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;font-size:13.600000381469727px;padding:0.2em 0px;margin:0px;background-color:rgba(0,0,0,0.0392157);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">module</code> followed by a fully qualified name and must occur as the first declaration in a file. For example:</p><div style="margin-bottom:16px;color:rgb(51,51,51);font-family:-apple-system,BlinkMacSystemFont,&#39;Segoe UI&#39;,Roboto,Helvetica,Arial,sans-serif,&#39;Apple Color Emoji&#39;,&#39;Segoe UI Emoji&#39;,&#39;Segoe UI Symbol&#39;;font-size:16px;background-color:rgb(255,255,255)"><pre style="font-family:Consolas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;font-size:13.600000381469727px;margin-top:0px;margin-bottom:0px;line-height:1.45;word-wrap:normal;padding:16px;overflow:auto;background-color:rgb(247,247,247);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;word-break:normal"><span style="color:rgb(150,152,150)">// ./Math/Integers/Arithmetic.swift</span>
module Math<span style="color:rgb(167,29,93)">.</span>Integers<span style="color:rgb(167,29,93)">.</span>Arithmetic

<span style="color:rgb(167,29,93)">public</span> <span style="color:rgb(167,29,93)">protocol</span> _IntegerArithmetic {}

<span style="color:rgb(167,29,93)">public</span> <span style="color:rgb(167,29,93)">struct</span> _Abs {}

<span style="color:rgb(167,29,93)">@_versioned</span>
<span style="color:rgb(167,29,93)">internal</span> <span style="color:rgb(167,29,93)">func</span> <span style="color:rgb(121,93,163)">_abs</span>&lt;Args&gt;(<span style="color:rgb(121,93,163)">_</span> <span>args</span>: Args) <span style="color:rgb(167,29,93)">-&gt;</span> (_Abs, Args) {}

<span style="color:rgb(150,152,150)">// ./Math/Integers.swift</span>
module Math<span style="color:rgb(167,29,93)">.</span>Integers

<span style="color:rgb(150,152,150)">// _abs is visible in this module and all others within the project, </span>
<span style="color:rgb(150,152,150)">// but is not exported along with it.</span>
<span style="color:rgb(167,29,93)">internal</span> <span style="color:rgb(167,29,93)">import</span> <span style="color:rgb(0,134,179)">Math.Integers.Arithmetic</span>

<span style="color:rgb(167,29,93)">public</span> <span style="color:rgb(167,29,93)">protocol</span> IntegerArithmetic <span style="color:rgb(167,29,93)">:</span> _IntegerArithmetic, <span style="color:rgb(0,134,179)">Comparable</span> {}
<span style="color:rgb(167,29,93)">public</span> <span style="color:rgb(167,29,93)">protocol</span> SignedNumber <span style="color:rgb(167,29,93)">:</span> <span style="color:rgb(0,134,179)">Comparable</span>, ExpressibleByIntegerLiteral {}


<span style="color:rgb(150,152,150)">// Math.swift</span>
module Math

<span style="color:rgb(150,152,150)">// Exports the entire public contents of Math.Integers, but nothing in </span>
<span style="color:rgb(150,152,150)">// Math.Integers.Arithmetic.</span>
<span style="color:rgb(167,29,93)">public</span> <span style="color:rgb(167,29,93)">import</span> <span style="color:rgb(0,134,179)">Math.Integers</span></pre></div><p style="margin-top:0px;margin-bottom:16px;color:rgb(51,51,51);font-family:-apple-system,BlinkMacSystemFont,&#39;Segoe UI&#39;,Roboto,Helvetica,Arial,sans-serif,&#39;Apple Color Emoji&#39;,&#39;Segoe UI Emoji&#39;,&#39;Segoe UI Symbol&#39;;font-size:16px;background-color:rgb(255,255,255)">Modules names are tied to a directory structure that describes their location relative to the current module and it will now be an error to violate this rule. For example:</p><div style="margin-bottom:16px;color:rgb(51,51,51);font-family:-apple-system,BlinkMacSystemFont,&#39;Segoe UI&#39;,Roboto,Helvetica,Arial,sans-serif,&#39;Apple Color Emoji&#39;,&#39;Segoe UI Emoji&#39;,&#39;Segoe UI Symbol&#39;;font-size:16px;background-color:rgb(255,255,255)"><pre style="font-family:Consolas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;font-size:13.600000381469727px;margin-top:0px;margin-bottom:0px;line-height:1.45;word-wrap:normal;padding:16px;overflow:auto;background-color:rgb(247,247,247);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;word-break:normal">module <span style="color:rgb(0,134,179)">String</span> <span style="color:rgb(150,152,150)">// lives in ./String.swift</span>
module <span style="color:rgb(0,134,179)">String</span><span style="color:rgb(167,29,93)">.</span>Core <span style="color:rgb(150,152,150)">// lives in ./String/Core.swift</span>
module <span style="color:rgb(0,134,179)">String</span><span style="color:rgb(167,29,93)">.</span>Core<span style="color:rgb(167,29,93)">.</span>Internals<span style="color:rgb(167,29,93)">.</span>Do<span style="color:rgb(167,29,93)">.</span>You<span style="color:rgb(167,29,93)">.</span>Even<span style="color:rgb(167,29,93)">.</span>Write <span style="color:rgb(150,152,150)">// lives in ./String/Core/Internals/Do/You/Even/Write.swift</span></pre></div><p style="margin-top:0px;margin-bottom:16px;color:rgb(51,51,51);font-family:-apple-system,BlinkMacSystemFont,&#39;Segoe UI&#39;,Roboto,Helvetica,Arial,sans-serif,&#39;Apple Color Emoji&#39;,&#39;Segoe UI Emoji&#39;,&#39;Segoe UI Symbol&#39;;font-size:16px;background-color:rgb(255,255,255)">Existing projects that do not adopt these rules will still retain their <em>implicit module name</em> (usually defined as the name of the framework or application that is being built) and may continue to use whatever directory structure they wish, however they may not declare any explicit modules.</p><p style="margin-top:0px;margin-bottom:16px;color:rgb(51,51,51);font-family:-apple-system,BlinkMacSystemFont,&#39;Segoe UI&#39;,Roboto,Helvetica,Arial,sans-serif,&#39;Apple Color Emoji&#39;,&#39;Segoe UI Emoji&#39;,&#39;Segoe UI Symbol&#39;;font-size:16px;background-color:rgb(255,255,255)">This proposal also solves the problem of module <em>export</em>. A module that is imported without an access level modifier will default to an <code style="font-family:Consolas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;font-size:13.600000381469727px;padding:0.2em 0px;margin:0px;background-color:rgba(0,0,0,0.0392157);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">internal</code> import per usual. However, when it is useful to fully expose the public content of submodules to a client, a <code style="font-family:Consolas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;font-size:13.600000381469727px;padding:0.2em 0px;margin:0px;background-color:rgba(0,0,0,0.0392157);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">public</code> modifier can be used. Similarly, when it is useful to access <code style="font-family:Consolas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;font-size:13.600000381469727px;padding:0.2em 0px;margin:0px;background-color:rgba(0,0,0,0.0392157);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">internal</code> or <code style="font-family:Consolas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;font-size:13.600000381469727px;padding:0.2em 0px;margin:0px;background-color:rgba(0,0,0,0.0392157);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">[file]private</code> APIs, but not expose them to clients, those access modifiers may be used. The rule of thumb is: Only identifiers that are at least as visible as the qualifier on the import make for valid import declarations. For example:</p><div style="margin-bottom:16px;color:rgb(51,51,51);font-family:-apple-system,BlinkMacSystemFont,&#39;Segoe UI&#39;,Roboto,Helvetica,Arial,sans-serif,&#39;Apple Color Emoji&#39;,&#39;Segoe UI Emoji&#39;,&#39;Segoe UI Symbol&#39;;font-size:16px;background-color:rgb(255,255,255)"><pre style="font-family:Consolas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;font-size:13.600000381469727px;margin-top:0px;margin-bottom:0px;line-height:1.45;word-wrap:normal;padding:16px;overflow:auto;background-color:rgb(247,247,247);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;word-break:normal"><span style="color:rgb(150,152,150)">// A submodule declaring a `private` class that gets imported with </span>
<span style="color:rgb(150,152,150)">// an `internal` qualifier with a `using` directive is an invalid import </span>
<span style="color:rgb(150,152,150)">// declaration.  </span>
module Foo<span style="color:rgb(167,29,93)">.</span>Bar

<span style="color:rgb(167,29,93)">private</span> <span style="color:rgb(167,29,93)">class</span> PrivateThing {}

module Foo

<span style="color:rgb(150,152,150)">// Error: PrivateThing not visible, use `private import`</span>
<span style="color:rgb(167,29,93)">import</span> <span style="color:rgb(0,134,179)">Foo.Bar</span> using (PrivateThing) </pre></div><div style="margin-bottom:16px;color:rgb(51,51,51);font-family:-apple-system,BlinkMacSystemFont,&#39;Segoe UI&#39;,Roboto,Helvetica,Arial,sans-serif,&#39;Apple Color Emoji&#39;,&#39;Segoe UI Emoji&#39;,&#39;Segoe UI Symbol&#39;;font-size:16px;background-color:rgb(255,255,255)"><pre style="font-family:Consolas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;font-size:13.600000381469727px;margin-top:0px;margin-bottom:0px;line-height:1.45;word-wrap:normal;padding:16px;overflow:auto;background-color:rgb(247,247,247);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;word-break:normal"><span style="color:rgb(150,152,150)">// However, a submodule declaring a `public` struct that gets imported with </span>
<span style="color:rgb(150,152,150)">// an `private` qualifier is a valid import declaration.</span>
module Foo<span style="color:rgb(167,29,93)">.</span>Bar

<span style="color:rgb(167,29,93)">public</span> <span style="color:rgb(167,29,93)">class</span> PublicThing {}

module Foo

<span style="color:rgb(150,152,150)">// All good!  Foo can see Foo.Bar.PrivateThing.</span>
<span style="color:rgb(167,29,93)">private</span> <span style="color:rgb(167,29,93)">import</span> <span style="color:rgb(0,134,179)">Foo.Bar</span> using (PublicThing) </pre></div><p style="margin-top:0px;margin-bottom:16px;color:rgb(51,51,51);font-family:-apple-system,BlinkMacSystemFont,&#39;Segoe UI&#39;,Roboto,Helvetica,Arial,sans-serif,&#39;Apple Color Emoji&#39;,&#39;Segoe UI Emoji&#39;,&#39;Segoe UI Symbol&#39;;font-size:16px;background-color:rgb(255,255,255)">Because import directives are file-local, they will never be exported along with a <code style="font-family:Consolas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;font-size:13.600000381469727px;padding:0.2em 0px;margin:0px;background-color:rgba(0,0,0,0.0392157);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">public</code> import and will default to exporting the entire contents of the module as though you had never declared them.</p><div style="margin-bottom:16px;color:rgb(51,51,51);font-family:-apple-system,BlinkMacSystemFont,&#39;Segoe UI&#39;,Roboto,Helvetica,Arial,sans-serif,&#39;Apple Color Emoji&#39;,&#39;Segoe UI Emoji&#39;,&#39;Segoe UI Symbol&#39;;font-size:16px;background-color:rgb(255,255,255)"><pre style="font-family:Consolas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;font-size:13.600000381469727px;margin-top:0px;margin-bottom:0px;line-height:1.45;word-wrap:normal;padding:16px;overflow:auto;background-color:rgb(247,247,247);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;word-break:normal"><span style="color:rgb(150,152,150)">// In this file and this file alone, the directives apply.  To the user</span>
<span style="color:rgb(150,152,150)">// of this module, it is as though this declaration were simply:</span>
<span style="color:rgb(150,152,150)">// public import Foundation.Date</span>
<span style="color:rgb(167,29,93)">public</span> <span style="color:rgb(167,29,93)">import</span> <span style="color:rgb(0,134,179)">Foundation.Date</span> hiding (Date<span style="color:rgb(167,29,93)">.</span><span style="color:rgb(167,29,93)">init</span>()) 
                              renaming (Date<span style="color:rgb(167,29,93)">.</span><span style="color:rgb(167,29,93)">Type</span><span style="color:rgb(167,29,93)">.</span>distantPast, 
                                        to: Date<span style="color:rgb(167,29,93)">.</span><span style="color:rgb(167,29,93)">Type</span><span style="color:rgb(167,29,93)">.</span>letsGoLivingInThePast,
                                        Date<span style="color:rgb(167,29,93)">.</span><span style="color:rgb(167,29,93)">Type</span><span style="color:rgb(167,29,93)">.</span>timeIntervalSinceReferenceDate, 
                                        to: Date<span style="color:rgb(167,29,93)">.</span><span style="color:rgb(167,29,93)">Type</span><span style="color:rgb(167,29,93)">.</span>startOfTheUniverse)
                              renaming (Date<span style="color:rgb(167,29,93)">.</span><span style="color:rgb(167,29,93)">Type</span>.&lt;, to: Date<span style="color:rgb(167,29,93)">.</span><span style="color:rgb(167,29,93)">Type</span>.&lt;&lt;&lt;&lt;&lt;)</pre></div><h2 style="margin-top:24px;margin-bottom:16px;line-height:1.25;padding-bottom:0.3em;border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:rgb(238,238,238);color:rgb(51,51,51);font-family:-apple-system,BlinkMacSystemFont,&#39;Segoe UI&#39;,Roboto,Helvetica,Arial,sans-serif,&#39;Apple Color Emoji&#39;,&#39;Segoe UI Emoji&#39;,&#39;Segoe UI Symbol&#39;;background-color:rgb(255,255,255)"><a href="https://gist.github.com/CodaFi/42e5e5e94d857547abc381d9a9d0afd6#impact-on-existing-code" style="background-color:transparent;color:rgb(64,120,192);text-decoration:none;float:left;padding-right:4px;line-height:1" target="_blank"><u></u><u></u><u></u><u></u></a>Impact on existing code</h2><p style="margin-top:0px;margin-bottom:16px;color:rgb(51,51,51);font-family:-apple-system,BlinkMacSystemFont,&#39;Segoe UI&#39;,Roboto,Helvetica,Arial,sans-serif,&#39;Apple Color Emoji&#39;,&#39;Segoe UI Emoji&#39;,&#39;Segoe UI Symbol&#39;;font-size:16px;background-color:rgb(255,255,255)">Existing code that is using qualified module import syntax (<code style="font-family:Consolas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;font-size:13.600000381469727px;padding:0.2em 0px;margin:0px;background-color:rgba(0,0,0,0.0392157);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">import {func|class|typealias|class|struct|enum|protocol} &lt;qualified-name&gt;</code>) will be deprecated. Code that is not organized into modules will remain unaffected and organized into one contiguous top-level module. However, it is strongly recommended that frameworks be decomposed and reorganized around the new module system.</p><p style="margin-top:0px;margin-bottom:16px;color:rgb(51,51,51);font-family:-apple-system,BlinkMacSystemFont,&#39;Segoe UI&#39;,Roboto,Helvetica,Arial,sans-serif,&#39;Apple Color Emoji&#39;,&#39;Segoe UI Emoji&#39;,&#39;Segoe UI Symbol&#39;;font-size:16px;background-color:rgb(255,255,255)">As a case study, the public interface to the standard library appears to already be mostly broken down into submodules as described in <a href="https://github.com/apple/swift/blob/master/stdlib/public/core/GroupInfo.json" style="background-color:transparent;color:rgb(64,120,192);text-decoration:none" target="_blank">GroupInfo.json</a>.</p><p style="margin-top:0px;margin-bottom:16px;color:rgb(51,51,51);font-family:-apple-system,BlinkMacSystemFont,&#39;Segoe UI&#39;,Roboto,Helvetica,Arial,sans-serif,&#39;Apple Color Emoji&#39;,&#39;Segoe UI Emoji&#39;,&#39;Segoe UI Symbol&#39;;font-size:16px;background-color:rgb(255,255,255)">Code that is defined in modulemaps already defines a module structure that can be imported directly into this scheme.</p><h2 style="margin-top:24px;margin-bottom:16px;line-height:1.25;padding-bottom:0.3em;border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:rgb(238,238,238);color:rgb(51,51,51);font-family:-apple-system,BlinkMacSystemFont,&#39;Segoe UI&#39;,Roboto,Helvetica,Arial,sans-serif,&#39;Apple Color Emoji&#39;,&#39;Segoe UI Emoji&#39;,&#39;Segoe UI Symbol&#39;;background-color:rgb(255,255,255)"><a href="https://gist.github.com/CodaFi/42e5e5e94d857547abc381d9a9d0afd6#alternatives-considered" style="background-color:transparent;color:rgb(64,120,192);text-decoration:none;float:left;padding-right:4px;line-height:1" target="_blank"><u></u><u></u><u></u><u></u></a>Alternatives considered</h2><p style="margin-top:0px;margin-bottom:16px;color:rgb(51,51,51);font-family:-apple-system,BlinkMacSystemFont,&#39;Segoe UI&#39;,Roboto,Helvetica,Arial,sans-serif,&#39;Apple Color Emoji&#39;,&#39;Segoe UI Emoji&#39;,&#39;Segoe UI Symbol&#39;;font-size:16px;background-color:rgb(255,255,255)">Module export can also be placed on the <code style="font-family:Consolas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;font-size:13.600000381469727px;padding:0.2em 0px;margin:0px;background-color:rgba(0,0,0,0.0392157);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">module</code> declaration itself. The relevant parts of the grammar that have changed are below with an example:</p><div style="margin-bottom:16px;color:rgb(51,51,51);font-family:-apple-system,BlinkMacSystemFont,&#39;Segoe UI&#39;,Roboto,Helvetica,Arial,sans-serif,&#39;Apple Color Emoji&#39;,&#39;Segoe UI Emoji&#39;,&#39;Segoe UI Symbol&#39;;font-size:16px;background-color:rgb(255,255,255)"><pre style="font-family:Consolas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;font-size:13.600000381469727px;margin-top:0px;margin-bottom:0px;line-height:1.45;word-wrap:normal;padding:16px;overflow:auto;background-color:rgb(247,247,247);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;word-break:normal">module-decl -&gt; &lt;access-level-modifier&gt; module &lt;module-path&gt;
import-decl -&gt; import &lt;module-path&gt; &lt;(opt) import-directive-list&gt;</pre></div><div style="margin-bottom:16px;color:rgb(51,51,51);font-family:-apple-system,BlinkMacSystemFont,&#39;Segoe UI&#39;,Roboto,Helvetica,Arial,sans-serif,&#39;Apple Color Emoji&#39;,&#39;Segoe UI Emoji&#39;,&#39;Segoe UI Symbol&#39;;font-size:16px;background-color:rgb(255,255,255)"><pre style="font-family:Consolas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;font-size:13.600000381469727px;margin-top:0px;margin-bottom:0px;line-height:1.45;word-wrap:normal;padding:16px;overflow:auto;background-color:rgb(247,247,247);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;word-break:normal"><span style="color:rgb(167,29,93)">private</span> module <span style="color:rgb(0,134,179)">String</span><span style="color:rgb(167,29,93)">.</span>Core<span style="color:rgb(167,29,93)">.</span>Internals

<span style="color:rgb(150,152,150)">// Shh, it&#39;s a secret.</span></pre></div><div style="margin-top:0px;color:rgb(51,51,51);font-family:-apple-system,BlinkMacSystemFont,&#39;Segoe UI&#39;,Roboto,Helvetica,Arial,sans-serif,&#39;Apple Color Emoji&#39;,&#39;Segoe UI Emoji&#39;,&#39;Segoe UI Symbol&#39;;font-size:16px;background-color:rgb(255,255,255);margin-bottom:0px!important">While this style makes it immediately obvious to the library author which modules are public or private, it causes the consumer problems because submodule exports are no longer explicit and are entirely ad-hoc. In the interest of enabling, for one, users of IDEs to drill into public submodules, making export local to <code style="font-family:Consolas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;font-size:13.600000381469727px;padding:0.2em 0px;margin:0px;background-color:rgba(0,0,0,0.0392157);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">import</code> seems more appropriate.</div></div></div>_______________________________________________<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>
</blockquote></div>
</div></blockquote></div></div></div><br></div></blockquote></div><br></div></div>