www.digitalmars.com         C & C++   DMDScript  

D - sourcefile/module collision

reply Helmut Leitner <helmut.leitner chello.at> writes:
If the Phobos library defines a module like
   random.d
then you risk a collision that can't be resolved
when you use a source file
   random.d
in the namespace (main directory) of your own
project.

This collision will turn up when you use a third
module (typically from a library).
Lets call this module libmod.d.

You have a 
  - sourcefile.d that imports libmod.d
  - libmod.d imports random.d
The compiler takes random.d from your project, not 
from the intended Phobos module, which leads to 
compiler errors within libmod.d. 
  
--
Helmut Leitner    leitner hls.via.at   
Graz, Austria   www.hls-software.com
Jun 08 2003
parent "Walter" <walter digitalmars.com> writes:
The version I'm working on now will allow private imports, which will deal
with this problem. -Walter

"Helmut Leitner" <helmut.leitner chello.at> wrote in message
news:3EE2FF54.A61A5E4E chello.at...
 If the Phobos library defines a module like
    random.d
 then you risk a collision that can't be resolved
 when you use a source file
    random.d
 in the namespace (main directory) of your own
 project.

 This collision will turn up when you use a third
 module (typically from a library).
 Lets call this module libmod.d.

 You have a
   - sourcefile.d that imports libmod.d
   - libmod.d imports random.d
 The compiler takes random.d from your project, not
 from the intended Phobos module, which leads to
 compiler errors within libmod.d.

 --
 Helmut Leitner    leitner hls.via.at
 Graz, Austria   www.hls-software.com
Jun 08 2003