www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Can there be two modules with the same name?

This doesn't compile:

-- c:\test\math.d ---

class Vector
{
}

---------------------

-- c:\test\main.d ---

import math;
import std.math;

int main()
{
    return 0;
}

---------------------

C:\test>dmd main.d
c:\dmd\bin\..\src\phobos\std\math.d(12): module math is in multiply
defined

Is it intentional or a bug? Common sense would say that "math" and
"std.math" would indeed be _different_ modules, not same.

I see that it compiles if I make a directory "dummy" and move "math.d"
to "dummy\math.d" and say "module dummy.math;" inside math.d. Perhaps
that's the right thing to do anyway. But the error message could perhaps
be more descriptive.

-Antti

-- 
I will not be using Plan 9 in the creation of weapons of mass destruction
to be used by nations other than the US.
Jun 13 2004