<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div><br><br><div>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); "> mobile)</span></div><div><br>On Jul 21, 2016, at 9:20 AM, Robert Widmann via swift-evolution <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> wrote:<br><br></div><blockquote type="cite"><div><meta http-equiv="content-type" content="text/html; charset=utf-8"><div><br><br>~Robert Widmann</div><div><br>2016/07/21 0:13、Pyry Jahkola via swift-evolution <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> のメッセージ:<br><br></div><blockquote type="cite"><div><meta http-equiv="Content-Type" content="text/html charset=utf-8"><br class=""><div><blockquote type="cite" class=""><div class="">On 21 Jul 2016, at 09:51, Robert Widmann via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class=""><blockquote type="cite" class="" style="font-family: Helvetica; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div class="">On Jul 20, 2016, at 9:37 PM, Félix Cloutier via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class="">The problem is that by specifying "import Foo using (Baz)", I get nothing else from Foo. If I only want to exclude one conflicting name, I would have:</div><div class=""><br class=""></div><div class=""></div><blockquote type="cite" class=""><div class="">import Foo</div><div class="">import Bar hiding (Baz)</div></blockquote><div class=""><br class=""></div><div class="">In case of a conflict, my "internal monologue" is more like "take Baz from Foo" than "don't take Baz from Bar".</div><div class=""><br class="Apple-interchange-newline"></div></div></div></blockquote><div style="font-family: Helvetica; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br class=""></div><div style="font-family: Helvetica; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">How else would you resolve an ambiguity than by selecting the appropriate declaration and hiding the others? Swift’s semantic analysis cannot read your mind, and neither can your (or mine) proposal for renaming syntax - in that you still have to import both modules either way. You may as well be explicit about which name you’re actually using and which ones you’re actually hiding, eh?</div></div></div></div></blockquote></div><br class="">Simple! You don't need to hide the others if we enforce a rule that explicitly mentioning one in the current file imports that name as a fileprivate identifier which shadows the ones not explicitly mentioned:</div></blockquote><div><br></div><div>What you're describing is making a distinction between an <i>open</i> module and an <i>imported</i> module and is both additive and out of scope for this particular proposal. We didn't want to touch module re-exports until that proposal came up later. This is a fantastic idea that we have plans to incorporate in there nonetheless. This distinction is far more powerful than our current approach of just opening every module that gets imported into the top level namespace.</div><div><br></div></div></blockquote><div><br></div><div>But it is a very limiting approach as has been seen in other languages and described here... designing a good system is as much about what it does today as what it will allow tomorrow and at what cost. Addressing the needs of today in a carpe diem fashion is an approach that works well when u are unsure if there will ever be a tomorrow, not for building the foundations of a legacy. To quote someone smarter "today's solutions are tomorrow's problems".</div><br><blockquote type="cite"><div><div><blockquote type="cite"><div><div class=""><br class=""></div><div class=""><span style="font-family: Menlo;" class=""> </span><b style="font-family: Menlo;" class="">import</b><span style="font-family: Menlo;" class=""> A </span><b style="font-family: Menlo;" class="">using</b><span style="font-family: Menlo;" class=""> (X)</span></div><div class=""><div class=""><font face="Menlo" class=""> <b class="">import</b> B <font color="#919191" class="">// also exports X</font></font><span style="color: rgb(145, 145, 145); font-family: Menlo;" class=""> </span><span style="color: rgb(145, 145, 145); font-family: Menlo;" class="">which gets shadowed by A.X</span></div></div><div class=""><div class=""><font face="Menlo" class=""> <b class="">import</b> C <font color="#919191" class="">// also exports X which gets shadowed by A.X</font></font></div></div><div class=""><font face="Menlo" class=""><br class=""></font></div><div class=""><span style="font-family: Menlo;" class=""> assert(X.self == A.X.self)</span></div><div class=""><font face="Menlo" class=""> assert(X.self != B.X.self)</font></div><div class=""><font face="Menlo" class=""> assert(X.self != C.X.self)</font></div><div class=""><font face="Menlo" class=""> </font></div><div class=""><font face="Menlo" class=""> <font color="#ff2600" class=""><b class="">import</b> D <b class="">using</b> (X)</font></font></div><div class=""><font face="Menlo" class=""><font color="#919191" class=""> // </font><b class=""><font color="#ff2600" class="">error:</font></b><font color="#919191" class=""> invalid redeclaration of 'X'</font></font></div><div class=""><font face="Menlo" color="#919191" class=""> // <b class="">note:</b> previously declared here: 'import A using (X)'</font></div><div class=""></div><div class=""><font face="Menlo" class=""> </font></div><div class=""><font face="Menlo" class=""> <font color="#ff2600" class=""><b class="">typealias</b> X = Int</font></font></div><div class=""><font face="Menlo" class=""><font color="#919191" class=""> // </font><b class=""><font color="#ff2600" class="">error:</font></b><font color="#919191" class=""> invalid redeclaration of 'X'</font></font></div><div class=""><font face="Menlo" color="#919191" class=""> // <b class="">note:</b> previously declared here: 'import A using (X)'</font></div><div class=""><div class=""><br class=""></div><div class="">That would go nicely hand-in-hand with the idea that explicitly importing a module with a qualified name brings in the name of that module to the current file's scope:</div></div><div class=""><br class=""></div><div class=""><span style="font-family: Menlo;" class=""> </span><b style="font-family: Menlo;" class="">import</b><span style="font-family: Menlo;" class=""> A</span><font color="#919191" style="font-family: Menlo;" class=""> // ok, unqualified import keeps A as a second-class identifier</font></div><div class=""><span style="font-family: Menlo;" class=""> </span><b style="font-family: Menlo;" class="">import</b><span style="font-family: Menlo;" class=""> B </span><b style="font-family: Menlo;" class="">as</b><span style="font-family: Menlo;" class=""> B</span><font color="#919191" style="font-family: Menlo;" class=""> // ok, qualified import makes B a first-class identifier in file scope</font></div><div class=""><font color="#919191" style="font-family: Menlo;" class=""> </font></div><div class=""><font face="Menlo" class=""> <b class="">typealias</b> A = Int <font color="#919191" class="">// ok, shadows the module name A</font></font></div><div class=""><font face="Menlo" class=""><font color="#919191" class=""> </font></font></div><div class=""><font face="Menlo" class=""> <font color="#ff2600" class=""><b class="">typealias</b> B = Int</font></font></div><div class=""><font face="Menlo" class=""><font color="#919191" class=""> // </font><b class=""><font color="#ff2600" class="">error:</font></b><font color="#919191" class=""> invalid redeclaration of 'Bar'</font></font></div><div class=""><font face="Menlo" color="#919191" class=""> // <b class="">note:</b> previously declared here: 'import Bar as Bar'</font></div><div class=""><br class=""></div><div class="">Couldn't we find a synthesis with <b class="">both</b> the explicit qualification of modules <b class="">and</b> the explicit selection of imported names? I would strongly support that.</div><div class=""><br class=""></div><div class="">— Pyry</div><div class=""><br class=""></div></div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>swift-evolution mailing list</span><br><span><a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a></span><br><span><a href="https://lists.swift.org/mailman/listinfo/swift-evolution">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br></div></blockquote></div></div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>swift-evolution mailing list</span><br><span><a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a></span><br><span><a href="https://lists.swift.org/mailman/listinfo/swift-evolution">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br></div></blockquote></body></html>