<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=""><div class="">I'm (personally) not such a fan of saying "import just this one thing" or "import everything except this one thing"—you end up trying to use UIImage(named:), and then realizing you haven't imported any of the top-level names. But "import qualified" seems great to me, and "import Foo as Bar" also seems reasonable.</div><div class=""><br class=""></div><div class="">Jordan</div><div class=""><br class=""></div><br class=""><div><blockquote type="cite" class=""><div class="">On Dec 28, 2015, at 16:47, Kevin Ballard 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="">


<title class=""></title>

<div class=""><div class="">I like the idea here, but I'm not sold on the syntax. I also do explicitly want an `import qualified`. And with qualified imports, I question whether we really need to support renaming in the import syntax here.<br class=""></div>
<div class="">&nbsp;</div>
<div class="">I'm tempted to say we should just crib Haskell's import rules (<a href="https://wiki.haskell.org/Import" class="">https://wiki.haskell.org/Import</a>), with the minor change that importing members by name still makes them accessible via the module name too (in Haskell `import Mod (x, y)` makes `x` and `y` visible but does not make `Mod.x` or `Mod.y` visible). This lets you say things like<br class=""></div>
<div class="">&nbsp;</div>
<div class=""><span class="font" style="font-family: menlo, consolas, &quot;courier new&quot;, monospace, sans-serif;"><b class="">import</b> Mod // imports Mod and all its members<br class=""></span></div>
<div class=""><span class="font" style="font-family: menlo, consolas, &quot;courier new&quot;, monospace, sans-serif;"><b class="">import</b> Mod () // only provides access to protocol conformances declared in Mod, doesn't actually <b class="">import</b> anything</span><span class="font" style="font-family: menlo, consolas, &quot;courier new&quot;, monospace, sans-serif;"><br class=""></span></div>
<div class=""><span class="font" style="font-family: menlo, consolas, &quot;courier new&quot;, monospace, sans-serif;"><b class="">import</b> Mod <b class="">(</b>x,y<b class="">)</b> // imports `x` and `y`, which are also accessible as e.g. `Mod.x`, but does not provide `z` or `Mod.z`</span><span class="font" style="font-family: menlo, consolas, &quot;courier new&quot;, monospace, sans-serif;"><br class=""></span></div>
<div class=""><span class="font" style="font-family: menlo, consolas, &quot;courier new&quot;, monospace, sans-serif;"><b class="">import qualified</b> Mod // imports Mod but all access to members has to go through it, e.g. `Mod.x`</span><span class="font" style="font-family: menlo, consolas, &quot;courier new&quot;, monospace, sans-serif;"><br class=""></span></div>
<div class=""><span class="font" style="font-family: menlo, consolas, &quot;courier new&quot;, monospace, sans-serif;"><b class="">import qualified</b> Mod <b class="">(</b>x,y<b class="">)</b> // imports Mod but only provides access to `Mod.x` and `Mod.y` but not e.g. `Mod.z`</span><span class="font" style="font-family: menlo, consolas, &quot;courier new&quot;, monospace, sans-serif;"><br class=""></span></div>
<div class=""><span class="font" style="font-family: menlo, consolas, &quot;courier new&quot;, monospace, sans-serif;"><b class="">import </b>Mod <b class="">hiding</b> <b class="">(</b>x,y<b class="">)</b> // imports Mod and its members except for `x` or `y`<br class=""></span></div>
<div class=""><span class="font" style="font-family: menlo, consolas, &quot;courier new&quot;, monospace, sans-serif;"><b class="">import qualified</b> Mod <b class="">hiding</b> <b class="">(</b>x,y<b class="">)</b> // imports e.g. `Mod.z` but not `Mod.x` or `Mod.y`</span><span class="font" style="font-family: menlo, consolas, &quot;courier new&quot;, monospace, sans-serif;"><b class=""><br class=""></b></span></div>
<div class=""><span class="font" style="font-family: menlo, consolas, &quot;courier new&quot;, monospace, sans-serif;"><b class="">import</b> Mod <b class="">as</b> Foo // imports Mod and renames the module to Foo, so e.g. `x` and `Foo.x` are accessible<br class=""></span></div>
<div class=""><span class="font" style="font-family: menlo, consolas, &quot;courier new&quot;, monospace, sans-serif;"><b class="">import</b> Mod <b class="">as</b> Foo <b class="">(</b>x,y<b class="">)</b> // renames Mod to Foo, provides `x`, `y`, `Foo.x`, and `Foo.y`</span><span class="font" style="font-family: menlo, consolas, &quot;courier new&quot;, monospace, sans-serif;"><br class=""></span></div>
<div class=""><span class="font" style="font-family: menlo, consolas, &quot;courier new&quot;, monospace, sans-serif;"><b class="">import qualified</b> Mod <b class="">as</b> Foo // renames Mod to Foo, all members are accessible via the module e.g. `Foo.x`</span><span class="font" style="font-family: menlo, consolas, &quot;courier new&quot;, monospace, sans-serif;"><br class=""></span></div>
<div class=""><span class="font" style="font-family: menlo, consolas, &quot;courier new&quot;, monospace, sans-serif;"><b class="">import qualified</b> Mod <b class="">as</b> Foo <b class="">(</b>x,y<b class="">)</b> // renames Mod to Foo, provides access to `Foo.x` and `Foo.y` but not e.g. `Foo.z`</span><span class="font" style="font-family: menlo, consolas, &quot;courier new&quot;, monospace, sans-serif;"><br class=""></span></div>
<div class="">&nbsp;</div>
<div class="">Furthermore, you can have multiple import statements from the same module, so you can say something like<br class=""></div>
<div class="">&nbsp;</div>
<div class=""><span class="font" style="font-family: menlo, consolas, &quot;courier new&quot;, monospace, sans-serif;"><b class="">import qualified</b> Mod</span></div>
<div class=""><span class="font" style="font-family: menlo, consolas, &quot;courier new&quot;, monospace, sans-serif;"><b class="">import</b> Mod <b class="">(</b>x,y<b class="">)</b><br class=""></span></div>
<div class="">&nbsp;</div>
<div class="">to provide access to all of Mod qualified with the name, and additionally import `x` and `y` as unqualified identifiers.<br class=""></div>
<div class="">&nbsp;</div>
<div class="">-Kevin Ballard</div>

<img src="https://u2002410.ct.sendgrid.net/wf/open?upn=ZEz4qHYnXhPr3bBPu-2FxP4tN3HfWKL-2FtJpqkQ0gkOVSDJuvR-2BeaFrMtzkjcI7PSxzr18m-2Br2hfucKk8-2F6wT1wirG9c059pFw5W8T-2FdaNFicx3D18Tuo-2FO-2BUcjct-2FZx2faAU2UTuBkO5TLYMf6goYD6algn98uZT9AK6dvvHPj6-2FpYs5mDgXdltJWC-2FXqgSHhJ-2B9KtzfVZ1R4xcH0cBOhRe4VMDzdMk9e9Bs3fI-2BVCIWI-3D" alt="" width="1" height="1" border="0" style="height:1px !important;width:1px !important;border-width:0 !important;margin-top:0 !important;margin-bottom:0 !important;margin-right:0 !important;margin-left:0 !important;padding-top:0 !important;padding-bottom:0 !important;padding-right:0 !important;padding-left:0 !important;" class="">
</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=""></body></html>