<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="">As cannot (and should not) hide substructures and can be added later if you so desire.<div class=""><br class=""></div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Jul 20, 2016, at 3:36 PM, L. Mihalkovic &lt;<a href="mailto:laurent.mihalkovic@gmail.com" class="">laurent.mihalkovic@gmail.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="content-type" content="text/html; charset=utf-8" class=""><div dir="auto" class=""><div class="">Hiding is not necessary if you import into a pseudo container... It means the ide does not have to keep track of whats here whats not on a per source file basis....</div><div class=""><br class=""></div><div class="">Import CoreGraphics as cg</div><div class="">cg.xxxxx</div><div class=""><br class=""></div><div class="">Collisions are always avoided and there is only adding imports. Simple.<br class=""><br class=""><div class="">Regards</div>(From<span class="Apple-style-span" style="-webkit-tap-highlight-color: rgba(26, 26, 26, 0.296875); -webkit-composition-fill-color: rgba(175, 192, 227, 0.230469); -webkit-composition-frame-color: rgba(77, 128, 180, 0.230469); ">&nbsp;mobile)</span></div><div class=""><br class="">On Jul 20, 2016, at 11:04 PM, Robert Widmann via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:<br class=""><br class=""></div><blockquote type="cite" class=""><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Jul 20, 2016, at 1:59 PM, Xiaodi Wu &lt;<a href="mailto:xiaodi.wu@gmail.com" class="">xiaodi.wu@gmail.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class="">Why is hiding in-scope but renaming out-of-scope?</div></blockquote><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Because hiding and renaming can be used in combination to subset out APIs, not alter them.</div><br class=""><blockquote type="cite" class=""><div class=""> Both are additive to Swift, </div></blockquote><div class=""><br class=""></div><div class="">As part of this proposal, both are source-breaking.</div><br class=""><blockquote type="cite" class=""><div class="">and as has been argued by others, the former is a special case of the latter.<br class=""></div></blockquote><div class=""><br class=""></div><div class="">A special case that cannot cause large-scale file-relative changes to APIs. &nbsp;Renaming is primarily used in other languages that treat free functions as more canonical than we do, or allow operator definitions that can be used as notation. &nbsp;In those cases, you often have your own notation you’d like to use. &nbsp;In Swift, such changes should be rare enough that if you can’t solve them with a disambiguating qualified import then you can just redeclare the identifier some other way (typealias, top-level let, wrapper class, whatever).</div><br class=""><blockquote type="cite" class=""><div class=""><br class=""><div class="gmail_quote"><div dir="ltr" class="">On Wed, Jul 20, 2016 at 15:55 Brandon Knope &lt;<a href="mailto:bknope@me.com" class="">bknope@me.com</a>&gt; wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto" class=""><div class=""></div><div class="">I meant is there any reason for requiring parentheses&nbsp;</div></div><div dir="auto" class=""><div class=""><br class="">On Jul 20, 2016, at 4:53 PM, Robert Widmann &lt;<a href="mailto:rwidmann@apple.com" target="_blank" class="">rwidmann@apple.com</a>&gt; wrote:<br class=""><br class=""></div><blockquote type="cite" class=""><div class="">Renaming is out of scope for this proposal, that’s why.<div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Jul 20, 2016, at 1:26 PM, Brandon Knope &lt;<a href="mailto:bknope@me.com" target="_blank" class="">bknope@me.com</a>&gt; wrote:</div><br class=""><div class=""><div dir="auto" class=""><div class=""></div><div class="">I prefer this 100x more</div><div class=""><br class=""></div><div class="">Is there any reason why this wouldn't work?</div><div class=""><br class=""></div><div class="">Brandon&nbsp;</div><div class=""><br class="">On Jul 20, 2016, at 4:13 PM, Xiaodi Wu &lt;<a href="mailto:xiaodi.wu@gmail.com" target="_blank" class="">xiaodi.wu@gmail.com</a>&gt; wrote:<br class=""><br class=""></div><blockquote type="cite" class=""><div class="">Yeah, I'd be happy to lose the parentheses as well.<br class=""><br class="">In the last thread, my take on simplifying the proposed syntax was:<br class=""><br class="">```<br class="">import Swift using String, Int<br class=""><br class="">// or, for hiding:<br class="">import Swift using Int as _<br class="">```<br class=""><br class="">The key simplification here is that hiding doesn't need its own contextual keyboard, especially if we support renaming (a huge plus in my book), as renaming to anything unused (or explicitly to `_`) is what hiding is all about.<br class=""><div class="gmail_quote"><div dir="ltr" class="">On Wed, Jul 20, 2016 at 15:01 Brandon Knope &lt;<a href="mailto:bknope@me.com" target="_blank" class="">bknope@me.com</a>&gt; wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto" class=""><div class=""></div><div style="direction:inherit" class=""><br class=""></div><div class=""><br class="">On Jul 20, 2016, at 3:08 PM, Xiaodi Wu via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>&gt; wrote:<br class=""><br class=""></div><blockquote type="cite" class=""><div class=""><div dir="ltr" class="">As Joe and others mentioned in the previous thread, this syntax could be greatly simplified in ways that resemble analogous facilities in other languages. In particular I think it's alarmingly asymmetrical that, in your proposal, `import Swift using (String)` imports *only* String while `import Swift hiding (String)` imports *everything but* String. This becomes evident when chained together:<div class=""><br class=""></div><div class="">```</div><div class="">import Swift using (String, Int)</div><div class="">// imports only String and Int</div><div class="">import Swift using (String, Int) hiding (String)</div><div class="">// imports only Int</div><div class="">import Swift hiding (String, Int)</div><div class="">// imports everything except String and Int</div><div class="">import Swift hiding (String, Int) using (String)</div><div class="">// imports *nothing*? nothing except String? everything except Int? confusing.</div><div class="">```</div><div class=""><br class=""></div><div class="">By contrast, Joe's proposed syntax (with some riffs) produces something much more terse *and* much more clear:</div><div class=""><br class=""></div><div class="">```</div><div class="">import Swift.*</div><div class="">import Swift.(Int as MyInt, *)</div><div class="">import Swift.(Int as _, *)</div><div class="">```</div></div></div></blockquote><div style="direction:inherit" class=""><br class=""></div></div><div dir="auto" class=""><div style="direction:inherit" class="">I really don't find this much clearer than the proposed one. The proposal reads much clearer.&nbsp;</div><div style="direction:inherit" class=""><br class=""></div><div style="direction:inherit" class="">Joe's syntax has a lot going on in my opinion.</div><div style="direction:inherit" class=""><br class=""></div><div style="direction:inherit" class="">For the proposal, do we really need the parentheses? It makes the syntax look heavier</div></div><div dir="auto" class=""><div style="direction:inherit" class=""><br class=""></div><div style="direction:inherit" class="">Brandon&nbsp;</div></div><div dir="auto" class=""><div style="direction:inherit" class=""><br class=""></div><div style="direction:inherit" class=""><br class=""></div><div style="direction:inherit" class=""><br class=""></div><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class=""><br class=""></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Wed, Jul 20, 2016 at 1:52 PM, Robert Widmann via swift-evolution <span dir="ltr" class="">&lt;<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>&gt;</span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class="">Hello all,<div class=""><br class=""></div><div class="">I’d like to thank the members of the community that have guided the revisions of this proposal.&nbsp; We have decided to heed the advice of the community and break down our original proposal on modules and qualified imports into source-breaking (qualified imports) and additive (modules) proposals.&nbsp; As qualified imports is the change most suited to Swift 3, we are pushing that proposal now as our final draft.</div><div class=""><br class=""></div><div class="">It can be had inline with this email, on&nbsp;<a href="https://github.com/apple/swift-evolution/pull/440" target="_blank" class="">Github</a>, or&nbsp;<a href="https://gist.github.com/CodaFi/42e5e5e94d857547abc381d9a9d0afd6" target="_blank" class="">as a gist</a>.</div><div class=""><br class=""></div><div class="">Thanks,</div><div class=""><br class=""></div><div class="">~Robert Widmann</div><div class=""><br class=""></div><div class=""><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,'Segoe UI',Roboto,Helvetica,Arial,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';background-color:rgb(255,255,255);margin-top:0px!important" class="">Qualified Imports Revisited</h1><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,'Segoe UI',Roboto,Helvetica,Arial,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';background-color:rgb(255,255,255);margin-top:0px!important" class=""><ul style="padding-left:2em;margin-top:0px;margin-bottom:16px;font-size:16px;font-weight:normal" class=""><li class="">Proposal:&nbsp;<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" class="">SE-NNNN</a></li><li style="margin-top:0.25em" class="">Authors:&nbsp;<a href="https://github.com/codafi" style="background-color:transparent;color:rgb(64,120,192);text-decoration:none" target="_blank" class="">Robert Widmann</a>,&nbsp;<a href="https://github.com/griotspeak" style="background-color:transparent;color:rgb(64,120,192);text-decoration:none" target="_blank" class="">TJ Usiyan</a></li><li style="margin-top:0.25em" class="">Status:&nbsp;<span style="font-weight:600" class="">Awaiting review</span></li><li style="margin-top:0.25em" class="">Review manager: TBD</li></ul></h1><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,'Segoe UI',Roboto,Helvetica,Arial,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';background-color:rgb(255,255,255)" class=""><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" class=""><u class=""></u><u class=""></u><u class=""></u><u class=""></u></a>Introduction</h2><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,'Segoe UI',Roboto,Helvetica,Arial,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';background-color:rgb(255,255,255);margin-top:0px!important" class=""><p style="margin-top:0px;margin-bottom:16px;font-size:16px;font-weight:normal" class="">We propose a complete overhaul of the qualified imports syntax and semantics.</p></h1><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,'Segoe UI',Roboto,Helvetica,Arial,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';background-color:rgb(255,255,255)" class=""><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" class=""><u class=""></u><u class=""></u><u class=""></u><u class=""></u></a>Motivation</h2><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,'Segoe UI',Roboto,Helvetica,Arial,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';background-color:rgb(255,255,255);margin-top:0px!important" class=""><p style="margin-top:0px;margin-bottom:16px;font-size:16px;font-weight:normal" class="">The existing syntax for qualified imports from modules is needlessly explicit, does not compose, and has a default semantics that dilutes the intended meaning of the very operation itself. Today, a qualified import looks something like this</p><div style="margin-bottom:16px;font-size:16px;font-weight:normal" class=""><pre style="font-family:Consolas,'Liberation Mono',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" class=""><span style="color:rgb(167,29,93)" class="">import</span> <span style="color:rgb(167,29,93)" class="">class</span> <span style="color:rgb(0,134,179)" class="">Foundation.Date</span></pre></div><p style="margin-top:0px;margin-bottom:16px;font-size:16px;font-weight:normal" class="">This means that clients of Foundation that wish to see only&nbsp;<code style="font-family:Consolas,'Liberation Mono',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" class="">Date</code>&nbsp;must know the exact kind of declaration that identifier is. In addition, though this import specifies exactly one class be imported from Foundation, the actual semantics mean Swift will recursively open all of Foundation's submodules so you can see, and use, every other identifier anyway - and they are not filtered from code completion. Qualified imports deserve to be first-class in Swift, and that is what we intend to make them with this proposal.</p></h1><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,'Segoe UI',Roboto,Helvetica,Arial,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';background-color:rgb(255,255,255)" class=""><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" class=""><u class=""></u><u class=""></u><u class=""></u><u class=""></u></a>Proposed solution</h2><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,'Segoe UI',Roboto,Helvetica,Arial,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';background-color:rgb(255,255,255);margin-top:0px!important" class=""><p style="margin-top:0px;margin-bottom:16px;font-size:16px;font-weight:normal" class="">The grammar and semantics of qualified imports will change completely with the addition of&nbsp;<em class="">import qualifiers</em>&nbsp;and&nbsp;<em class="">import directives</em>. We also introduce two new contextual keywords:&nbsp;<code style="font-family:Consolas,'Liberation Mono',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" class="">using</code>&nbsp;and&nbsp;<code style="font-family:Consolas,'Liberation Mono',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" class="">hiding</code>, to facilitate fine-grained usage of module contents.</p></h1><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,'Segoe UI',Roboto,Helvetica,Arial,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';background-color:rgb(255,255,255)" class=""><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" class=""><u class=""></u><u class=""></u><u class=""></u><u class=""></u></a>Detailed design</h2><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,'Segoe UI',Roboto,Helvetica,Arial,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';background-color:rgb(255,255,255);margin-top:0px!important" class=""><p style="margin-top:0px;margin-bottom:16px;font-size:16px;font-weight:normal" class="">Qualified import syntax will be revised to the following</p><pre style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:13.600000381469727px;margin-top:0px;margin-bottom:16px;font-weight:normal;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" class=""><code style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;padding:0px;margin:0px;background-color:transparent;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;word-break:normal;border:0px;display:inline;overflow:visible;line-height:inherit;word-wrap:normal" class="">import-decl -&gt; import &lt;import-path&gt; &lt;(opt) import-directive-list&gt;
import-path -&gt; &lt;identifier&gt;
            -&gt; &lt;identifier&gt;.&lt;identifier&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;, ...)
</code></pre><p style="margin-top:0px;margin-bottom:16px;font-size:16px;font-weight:normal" class="">This introduces the concept of an import&nbsp;<em class="">directive</em>. An import directive is a file-local modification of an imported identifier. A directive can be one of 2 operations:</p><p style="margin-top:0px;margin-bottom:16px;font-size:16px;font-weight:normal" class="">1)&nbsp;<em class="">using</em>: The&nbsp;<em class="">using</em>&nbsp;directive is followed by a list of identifiers for non-member nominal declarations within the imported module that should be exposed to this file.&nbsp;</p><div style="margin-bottom:16px;font-size:16px;font-weight:normal" class=""><pre style="font-family:Consolas,'Liberation Mono',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" class=""><span style="color:rgb(150,152,150)" class="">// The only visible parts of Foundation in this file are </span>
<span style="color:rgb(150,152,150)" class="">// Foundation.Date, Foundation.DateFormatter, and Foundation.DateComponents</span>
<span style="color:rgb(150,152,150)" class="">//</span>
<span style="color:rgb(150,152,150)" class="">// Previously, this was</span>
<span style="color:rgb(150,152,150)" class="">// import class Foundation.Date</span>
<span style="color:rgb(150,152,150)" class="">// import class Foundation.DateFormatter</span>
<span style="color:rgb(150,152,150)" class="">// import class Foundation.DateComponents</span>
<span style="color:rgb(167,29,93)" class="">import</span> <span style="color:rgb(0,134,179)" class="">Foundation</span> using (Date, DateFormatter, DateComponents)</pre></div><p style="margin-top:0px;margin-bottom:16px;font-size:16px;font-weight:normal" class="">2)&nbsp;<em class="">hiding</em>: The&nbsp;<code style="font-family:Consolas,'Liberation Mono',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" class="">hiding</code>&nbsp;directive is followed by a list of identifiers for non-member nominal declarations within the imported module that should be hidden from this file.</p><div style="margin-bottom:16px;font-size:16px;font-weight:normal" class=""><pre style="font-family:Consolas,'Liberation Mono',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" class=""><span style="color:rgb(150,152,150)" class="">// Imports all of Foundation except `Date`</span>
<span style="color:rgb(167,29,93)" class="">import</span> <span style="color:rgb(0,134,179)" class="">Foundation</span> hiding (Date)</pre></div><p style="margin-top:0px;margin-bottom:16px;font-size:16px;font-weight:normal" class="">As today, all hidden identifiers do not hide the type, they merely hide that type’s members and its declaration. For example, this means values of hidden types are still allowed. Unlike the existing implementation, using their members is forbidden.</p><div style="margin-bottom:16px;font-size:16px;font-weight:normal" class=""><pre style="font-family:Consolas,'Liberation Mono',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" class=""><span style="color:rgb(150,152,150)" class="">// Imports `DateFormatter` but the declaration of `Date` is hidden.</span>
<span style="color:rgb(167,29,93)" class="">import</span> <span style="color:rgb(0,134,179)" class="">Foundation</span> using (DateFormatter)

<span style="color:rgb(167,29,93)" class="">var</span> d <span style="color:rgb(167,29,93)" class="">=</span> DateFormatter()<span style="color:rgb(167,29,93)" class="">.</span>date(from: <span style="color:rgb(24,54,145)" class=""><span class="">"</span>...<span class="">"</span></span>) <span style="color:rgb(150,152,150)" class="">// Valid</span>
<span style="color:rgb(167,29,93)" class="">var</span> dt <span style="color:rgb(167,29,93)" class="">:</span> Date <span style="color:rgb(167,29,93)" class="">=</span> DateFormatter()<span style="color:rgb(167,29,93)" class="">.</span>date(from: <span style="color:rgb(24,54,145)" class=""><span class="">"</span>...<span class="">"</span></span>) <span style="color:rgb(150,152,150)" class="">// Invalid: Cannot use name of hidden type.</span>
d<span style="color:rgb(167,29,93)" class="">.</span>addTimeInterval(<span style="color:rgb(0,134,179)" class="">5</span><span style="color:rgb(167,29,93)" class="">.</span><span style="color:rgb(0,134,179)" class="">0</span>) <span style="color:rgb(150,152,150)" class="">// Invalid: Cannot use members of hidden type.</span></pre></div><p style="margin-top:0px;margin-bottom:16px;font-size:16px;font-weight:normal" class="">Import directives chain to one another and can be used to create a fine-grained module import:</p><div style="margin-bottom:16px;font-size:16px;font-weight:normal" class=""><pre style="font-family:Consolas,'Liberation Mono',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" class=""><span style="color:rgb(150,152,150)" class="">// This imports Swift.Int, Swift.Double, and Swift.String but hides Swift.String.UTF8View</span>
<span style="color:rgb(167,29,93)" class="">import</span> <span style="color:rgb(0,134,179)" class="">Swift</span> using (<span style="color:rgb(0,134,179)" class="">String</span>, <span style="color:rgb(0,134,179)" class="">Int</span>, <span style="color:rgb(0,134,179)" class="">Double</span>) 
             hiding (<span style="color:rgb(0,134,179)" class="">String</span><span style="color:rgb(167,29,93)" class="">.</span>UTF8View)</pre></div><p style="margin-top:0px;margin-bottom:16px;font-size:16px;font-weight:normal" class="">Directive chaining occurs left-to-right:</p><div style="margin-bottom:16px;font-size:16px;font-weight:normal" class=""><pre style="font-family:Consolas,'Liberation Mono',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" class=""><span style="color:rgb(150,152,150)" class="">// 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)" class="">// because 1) Int is available 2) String is not, error.</span>
<span style="color:rgb(167,29,93)" class="">import</span> <span style="color:rgb(0,134,179)" class="">Swift</span> using (<span style="color:rgb(0,134,179)" class="">Int</span>) hiding (<span style="color:rgb(0,134,179)" class="">String</span>)
<span style="color:rgb(150,152,150)" class="">// Valid.  This will be merged as `using (Int)`</span>
<span style="color:rgb(167,29,93)" class="">import</span> <span style="color:rgb(0,134,179)" class="">Swift</span> using () using (<span style="color:rgb(0,134,179)" class="">Int</span>)
<span style="color:rgb(150,152,150)" class="">// Valid.  This will be merged as `hiding (String, Double)`</span>
<span style="color:rgb(167,29,93)" class="">import</span> <span style="color:rgb(0,134,179)" class="">Swift</span> hiding (<span style="color:rgb(0,134,179)" class="">String</span>) hiding (<span style="color:rgb(0,134,179)" class="">Double</span>) hiding ()
<span style="color:rgb(150,152,150)" class="">// Valid (if redundant). This will be merged as `using ()`</span>
<span style="color:rgb(167,29,93)" class="">import</span> <span style="color:rgb(0,134,179)" class="">Swift</span> using (<span style="color:rgb(0,134,179)" class="">String</span>) hiding (<span style="color:rgb(0,134,179)" class="">String</span>)</pre></div><p style="margin-top:0px;margin-bottom:16px;font-size:16px;font-weight:normal" class="">Because import directives are file-local, they will never be exported along with the module that declares them.</p></h1><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,'Segoe UI',Roboto,Helvetica,Arial,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';background-color:rgb(255,255,255)" class=""><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" class=""><u class=""></u><u class=""></u><u class=""></u><u class=""></u></a>Impact on existing code</h2><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,'Segoe UI',Roboto,Helvetica,Arial,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';background-color:rgb(255,255,255);margin-top:0px!important" class=""><p style="margin-top:0px;margin-bottom:16px;font-size:16px;font-weight:normal" class="">Existing code that is using qualified module import syntax (<code style="font-family:Consolas,'Liberation Mono',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" class="">import {func|class|typealias|class|struct|enum|protocol} &lt;qualified-name&gt;</code>) will be deprecated and should be removed or migrated.&nbsp;</p></h1><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,'Segoe UI',Roboto,Helvetica,Arial,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';background-color:rgb(255,255,255)" class=""><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" class=""><u class=""></u><u class=""></u><u class=""></u><u class=""></u></a>Alternatives considered</h2><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,'Segoe UI',Roboto,Helvetica,Arial,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';background-color:rgb(255,255,255);margin-top:0px!important" class=""><div style="margin-top:0px;font-size:16px;font-weight:normal;margin-bottom:0px!important" class="">A previous iteration of this proposal introduced an operation to allow the renaming of identifiers, especially members. The original intent was to allow file-local modifications of APIs consumers felt needed to conform to their specific coding style. On review, we felt the feature was not as significant as to warrant inclusion and was ripe for abuse in large projects.</div></h1></div></div><br class="">_______________________________________________<br class="">
swift-evolution mailing list<br class="">
<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a><br class="">
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class="">
<br class=""></blockquote></div><br class=""></div></div>
</div></blockquote><blockquote type="cite" class=""><div class=""><span class="">_______________________________________________</span><br class=""><span class="">swift-evolution mailing list</span><br class=""><span class=""><a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a></span><br class=""><span class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br class=""></div></blockquote></div></blockquote></div>
</div></blockquote></div></div></blockquote></div><br class=""></div></div></blockquote></div></blockquote></div>
</div></blockquote></div><br class=""></div></blockquote><blockquote type="cite" class=""><div class=""><span class="">_______________________________________________</span><br class=""><span class="">swift-evolution mailing list</span><br class=""><span class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a></span><br class=""><span class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br class=""></div></blockquote></div></div></blockquote></div><br class=""></div></body></html>