On Fri, Mar 30, 2012 at 12:06 PM, Andrej Mitrovic <span dir="ltr"><<a href="mailto:andrej.mitrovich@gmail.com">andrej.mitrovich@gmail.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On 3/30/12, Andrei Alexandrescu <<a href="mailto:SeeWebsiteForEmail@erdani.org">SeeWebsiteForEmail@erdani.org</a>> wrote:<br>
> Destroy!<br>
<br>
"That means a program that imports std.algorithm may use "std.sort"<br>
for the symbol "std.algorithm.sort"."<br>
<br>
That's quite interesting. Would that also mean that you could do:<br>
import std.algorithm;  // has indexOf<br>
import std.string;  // has indexOf<br>
void main() {<br>
    string.indexOf("foo", "foo"); -> std.string.indexOf<br>
}<br>
<br></blockquote><div><br></div><div>I was actually kind of surprised when I found out this doesn't work.  It seems so natural to resolve ambiguity using as little context as necessary.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

That would ease usage of Phobos a little bit. OTOH 'string' already is<br>
a keyword and things might get hairy..<br>
<br>
Still this is one of the few proposals I like. My only caveat is the<br>
comment: "except the file is not allowed to use the "module"<br>
declaration.". Wouldn't it be better if we explicitly declared a<br>
module as a package instead? In foo\bar\package.d:<br>
package foo.bar;<br>
<br>
Since the "module" declaration must be on the first line (or second<br>
line after shebang), you could special-case DMD to allow the package<br>
keyword to be used here. I know D likes to abuse a keyword for<br>
multiple things (hello Mr. Static!), but I think we could live with<br>
it.<br>
</blockquote></div><br>