packageless modules == pure evil?

Bill Baxter dnewsgroup at billbaxter.com
Sun Feb 17 18:40:40 PST 2008


torhu wrote:
> Bill Baxter wrote:
>> The problem that prompted this message was that I had a module called 
>> just "blas" in one place and was trying to make another module called 
>> "dflat.blas".  But that breaks plain "import blas".  It picks up the 
>> "dflat.blas" rather than the packageless blas, even though I didn't 
>> specify that I wanted "dflat.blas".
> 
> It works when I try a simple test. I have a.d, b/a.d, and then import 
> just 'a' into test.d.
> 
> a.d:
> ---
> module a;
> 
> char[] s = "a";
> ---
> 
> b/a.d:
> ---
> module b.a;
> 
> char[] s = "b.a";
> ---
> 
> test.d:
> ---
> import std.stdio;
> import a;
> 
> void main()
> {
>     writefln(s);
> }
> ---
> 
> running:
> ---
> c:\prog\test\D\baxter>bud -exec test
> a
> ---
> 
> So a more complex test is needed to show the problem.  Maybe importing 
> from different include paths, etc?

Ok, thanks for helping me to work through this, torhu.

There may not be any pure evil going on here.  In trying to make a 
simple repro I've found that if I get rid of the top level a.d (or move 
it into a different subdir without using a -I to find it), I get the 
highly misleading error message:

     "b\c.d(4): module b.a is in multiple packages b.a"

So this could be the root of the problem.  I think that was the error I 
was seeing previously that made me thing it was mixing up the two 
modules.  I'll dig in a little more and report what I find.

--bb


More information about the Digitalmars-d-learn mailing list