How does the compiler look for the files of imports?

Don Clugston dac at nospam.com.au
Thu Sep 20 02:37:26 PDT 2007


Jarrett Billingsley wrote:
> "BCS" <ao at pathlink.com> wrote in message 
> news:ce0a3343236848c9c8a90d5226c2 at news.digitalmars.com...
>> What I'm thinking of is; start with the given file, if you can't find the 
>> imports and they share a common package prefix, check if the containing 
>> directory has your package as a suffix. If it does try removing the sufix 
>> and then check for the modules. For consistency, If you can't find /all/ 
>> imports using this new root in replacement of the current directly, then 
>> fail
> 
> So, you want the compiler to check the current directory and one directory 
> up.  Why not arbitrarily high up in the directory hierarchy?  It seems like 
> you want the compiler to solve this one problem, which is not so much a 
> problem as it is a misunderstanding of the correct behavior.
> 
> Just compile from the correct directory, use -I, or use a build tool.

Neither bud nor rebuild help with this situation.
-I is a hack.

Really, the problem is that the compiler is not consistent in its association of 
modules with files.

Module names correspond to directories and files in import statements, but they 
do not correspond to anything when used in module statements. That's the issue.



More information about the Digitalmars-d mailing list