<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="">I think that it takes some chutzpah to declare that your B-tree is authoritative enough that it should be called "BTreeCore". I also by far prefer BTree to MyBTree or BTreePackage; of course these are all possible workarounds for a name resolution *bug*, but they certainly don't sound great to me.<div class=""><br class=""></div><div class="">I'm also not suggesting that you can just do away with the "kit" or "core" in a module name: I'm saying that I find it intuitive to take the main class of a package and name your package after it. It's not like you can instantiate the Web from WebKit!</div><div class=""><div class=""><br class=""></div><div class="">Either way,&nbsp;<a href="https://github.com/kirsteins/BigInteger" class="">these</a>&nbsp;<a href="https://github.com/lorentey/BTree" class="">things</a>&nbsp;happen and I don't see anything fundamentally wrong with it. I'd prefer a fix to a restriction.<br class=""><div class="">
<br class="Apple-interchange-newline"><span style="color: rgb(0, 0, 0); font-family: 'Lucida Grande'; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline !important; float: none;" class="">Félix</span>
</div>
<br class=""><div><blockquote type="cite" class=""><div class="">Le 20 juin 2016 à 19:21:45, Xiaodi Wu &lt;<a href="mailto:xiaodi.wu@gmail.com" class="">xiaodi.wu@gmail.com</a>&gt; a écrit :</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">On Mon, Jun 20, 2016 at 9:08 PM, Félix Cloutier <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=""><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="word-wrap:break-word" class=""><div class="">I'm trying to reply to everybody in this message.</div><div class=""><br class=""></div><div class="">I think that it's a rather common and intuitive thing to name a module after its most important class, especially for small-ish packages. What would you call a package that provides a BTree, or a BigInt, and not much else?</div></div></blockquote><div class=""><br class=""></div><div class="">BTreeCore, BTreeKit, BTreePackage, MyBTree, MyBTreeCore, MyBTreeKit, MyBTreePackage...</div><div class="">&nbsp;</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="word-wrap:break-word" class=""><div class="">I'd also make the case that ManagedObject wouldn't be an awful name for CoreData, or Animation for CoreAnimation.</div></div></blockquote><div class=""><br class=""></div><div class="">On the contrary, I think these show that some sort of prefix or suffix is greatly beneficial. IMO, Data would be an absurd package name. Note how it's WebKit, UIKit, SpriteKit and not Web, UI, Sprite.</div><div class="">&nbsp;</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="word-wrap:break-word" class=""><div class="">If your package is big enough that it benefits from having a single class that serves as the entry point to it, it would also make sense to call it the same thing as your package.</div><div class=""><br class=""></div><div class="">I don't really like preventing modules from having a class with the same name, precisely because I think that it's an intuitive thing to do.</div><div class=""><br class=""></div><div class="">I could go with Module::Class too, given that : is not an operator character.</div><div class=""><br class=""></div><div class="">Paulo, given that I'm not sure about the direction that you're taking, it's a little hard to come up with a good name. "Disambiguating namespaces" or "namespace selection" or something like that could be a good start, maybe?</div><div class=""><span class=""><font color="#888888" class=""><div class="">
<br class=""><span style="font-family: 'Lucida Grande'; font-size: 12px; font-style: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; float: none; display: inline !important;" class="">Félix</span>
</div></font></span><div class=""><div class="h5">
<br class=""><div class=""><blockquote type="cite" class=""><div class="">Le 20 juin 2016 à 17:33:03, Paulo Faria &lt;<a href="mailto:paulo@zewo.io" target="_blank" class="">paulo@zewo.io</a>&gt; a écrit :</div><br class=""><div class=""><div style="word-wrap:break-word" class="">Yeah! I’m working on a formal proposal that would solve the same problem. Jordan, the problem he described is exactly like the one you explained to me, haha. Now I’m a bit confused about how the proposal should be called. Have any suggestions? What title could fit the two use cases we mentioned. By the way, can you see any other use case that would be solved with the same solution?<div class=""><br class=""></div><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Jun 20, 2016, at 9:25 PM, Jordan Rose &lt;<a href="mailto:jordan_rose@apple.com" target="_blank" class="">jordan_rose@apple.com</a>&gt; wrote:</div><br class=""><div class=""><div style="word-wrap:break-word" class=""><div class="">I've been encouraging Paulo Faria to mention this case in his push for a way to disambiguate extension methods, with the thought being we could then use the same syntax to differentiate top-level names as well.</div><div class=""><br class=""></div><div class="">I'd also be happy with the "import as" syntax. The underscore syntax seems a little opaque, but I suppose it wouldn't come up very often.</div><div class=""><br class=""></div><div class="">Jordan</div><div class=""><br class=""></div><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Jun 17, 2016, at 19:52, Félix Cloutier via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class=""><div class=""><div style="word-wrap:break-word" class="">Hello all,<div class=""><br class=""></div><span class="">I recently&nbsp;</span><a href="http://stackoverflow.com/q/37892621/251153" target="_blank" class="">ran into&nbsp;a&nbsp;bug</a><span class="">&nbsp;that leaves me unable to fully-qualify the name of a type. If you import a module named Foo that also&nbsp;contains a type named Foo, attempts to fully-qualify any name in the Foo module will instead attempt to find something inside the&nbsp;Foo type. This bug has&nbsp;</span><a href="https://bugs.swift.org/browse/SR-898" target="_blank" class="">already been reported</a><span class="">.<br class=""></span><div class=""><br class=""></div><div class="">Here's an example with&nbsp;Károly Lőrentey's BTree module (which also contains a BTree type) that I encountered while trying to use the OrderedSet type:</div><div class=""><br class=""></div><div class=""><pre style="margin-top:0px;padding:5px;border:0px;font-size:13px;width:auto;max-height:600px;overflow:auto;font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,sans-serif;background-color:rgb(239,240,241);color:rgb(57,51,24);word-wrap:normal" class=""><code style="margin:0px;padding:0px;border:0px;font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,sans-serif;white-space:inherit" class=""><span style="margin:0px;padding:0px;border:0px;color:rgb(16,16,148)" class="">let</span><span style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)" class=""> </span><span style="margin:0px;padding:0px;border:0px;color:rgb(16,16,148)" class="">set</span><span style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)" class=""> </span><span style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)" class="">=</span><span style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)" class=""> </span><span style="margin:0px;padding:0px;border:0px;color:rgb(43,145,175)" class="">OrderedSet</span><span style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)" class="">&lt;</span><span style="margin:0px;padding:0px;border:0px;color:rgb(43,145,175)" class="">Int</span><span style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)" class="">&gt;()</span><span style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)" class="">
</span><span style="margin:0px;padding:0px;border:0px;color:rgb(133,140,147)" class="">// error: 'OrderedSet' is ambiguous for type lookup in this context</span><span style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)" class="">
</span><span style="margin:0px;padding:0px;border:0px;color:rgb(133,140,147)" class="">// Found this candidate: Foundation.OrderedSet:3:14</span><span style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)" class="">
</span><span style="margin:0px;padding:0px;border:0px;color:rgb(133,140,147)" class="">// Found this candidate: BTree.OrderedSet:12:15</span></code></pre><div class="">To solve this, you would normally write BTree.OrderedSet, but now Swift thinks that BTree is the BTree type, not the BTree module:</div><div class=""><br class=""></div><div class=""><pre style="margin-top:0px;padding:5px;border:0px;font-size:13px;width:auto;max-height:600px;overflow:auto;font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,sans-serif;background-color:rgb(239,240,241);color:rgb(57,51,24);word-wrap:normal" class=""><code style="margin:0px;padding:0px;border:0px;font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,sans-serif;white-space:inherit" class=""><span style="margin:0px;padding:0px;border:0px;color:rgb(16,16,148)" class="">let</span><span style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)" class=""> </span><span style="margin:0px;padding:0px;border:0px;color:rgb(16,16,148)" class="">set</span><span style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)" class=""> </span><span style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)" class="">=</span><span style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)" class=""> </span><span style="margin:0px;padding:0px;border:0px;color:rgb(43,145,175)" class="">BTree</span><span style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)" class="">.</span><span style="margin:0px;padding:0px;border:0px;color:rgb(43,145,175)" class="">OrderedSet</span><span style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)" class="">&lt;</span><span style="margin:0px;padding:0px;border:0px;color:rgb(43,145,175)" class="">Int</span><span style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)" class="">&gt;()</span><span style="margin:0px;padding:0px;border:0px;color:rgb(48,51,54)" class="">
</span><span style="margin:0px;padding:0px;border:0px;color:rgb(133,140,147)" class="">// error: reference to generic type 'BTree' requires arguments in &lt;...&gt;</span></code></pre><div class="">Any fix will require a change to the language, and as Jordan Rose stated on the bug, it "needs design", so I would like to bring up the issue and discuss possible solutions.</div></div><div class=""><br class=""></div><div class="">I can see several options (leaving "do nothing" aside, since I believe that this needs to be resolved):</div><div class=""><br class=""></div><div class=""><ul class=""><li class="">Prevent modules from containing a type with the same name</li><li class="">Allow modules to be imported under different names (`import BTree as BTreeModule`, `import BTreeModule = BTree` or any similar syntax)</li><li class="">Create a new syntax that indicates that you're naming a module, not a type (like `_.BTree.OrderedSet`)</li></ul><div class=""><br class=""></div></div><div class="">Thoughts?</div><div class="">
<br class=""><span style="font-family:'Lucida Grande';font-size:12px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important" class="">Félix</span>
</div>
<br class=""></div></div>_______________________________________________<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" target="_blank" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class=""></div></blockquote></div><br class=""></div></div></blockquote></div><br class=""></div></div></div></blockquote></div><br class=""></div></div></div></div><br class="">_______________________________________________<br class="">
swift-evolution mailing list<br class="">
<a href="mailto:swift-evolution@swift.org" 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></div><br class=""></div></div></body></html>