Simple import question

Steven Schveighoffer via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Oct 15 09:11:22 PDT 2014


On 10/15/14 4:59 AM, Rei Roldan wrote:
> I don't see how passing all required files to the compiler could
> possible raise an issue with module discoverability. Unless I'm missing
> something? In regards to pains if "folder|file names / package|module
> names" don't match, imho, physical organization of files should never
> (ever) be of any concern to the compiler.


import a.b.c;

If you didn't pass the file for a.b.c to the compiler, how does it know 
where to find it?

The module system is inherently linked to the filesystem. The way around 
it is to pass all modules to the compiler that you will be importing so 
it knows where they are. But this can lead to problems if you don't 
actually want to compile them, just reference them.

The simplest thing to do is to make your file organization match your 
package/module structure. The compiler understands that and works well 
with it, no matter what you are doing.

-Steve


More information about the Digitalmars-d-learn mailing list