www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Module name clashes

reply Mike Capp <mike.capp gmail.com> writes:
Given

File math.d:

# import std.math;
# // etc

File main.d:

# import math;
# void main() {}

dmd main math

Is there a way to resolve this? If module names have to be globally unique within a program, what's the point of package qualifiers? cheers Mike
Jul 24 2005
parent reply Mike Parker <aldacron71 yahoo.com> writes:
Mike Capp wrote:
 Given
 
 File math.d:
 
 # import std.math;
 # // etc
 
 File main.d:
 
 # import math;
 # void main() {}
 
 
dmd main math

{...}\src\phobos\std\math.d(12): module math is in multiple defined Is there a way to resolve this? If module names have to be globally unique within a program, what's the point of package qualifiers? cheers Mike

Jul 25 2005
parent Mike Capp <mike.capp gmail.com> writes:
In article <dc40mj$2nka$1 digitaldaemon.com>, Mike Parker says...
Mike Capp wrote:
 Given
 
 File math.d:
 
 # import std.math;
 # // etc
 
 File main.d:
 
 # import math;
 # void main() {}
 
 
dmd main math

{...}\src\phobos\std\math.d(12): module math is in multiple defined Is there a way to resolve this? If module names have to be globally unique within a program, what's the point of package qualifiers?


Are you using a module statement at the top of your module?

No, I wasn't, and yes, the problem goes away if I add a module statement with an explicit package qualifier. Thanks for that. I'm still puzzled as to what's going on, though. If the package is part of the module identifier then there shouldn't have been a clash in the first place, and if it isn't then the module statement shouldn't have made any difference. Is this a (known) bug in D? cheers Mike
Aug 02 2005