Working with modules

Colin Grogan grogan.colin at gmail.com
Fri Feb 15 03:04:29 PST 2013


On Friday, 15 February 2013 at 10:40:57 UTC, Dicebot wrote:
> On Friday, 15 February 2013 at 10:31:41 UTC, Colin Grogan wrote:
>> Ah, ok.
>>
>> So, I have my structure like so:
>>
>> $PROJHOME
>>    |-src
>>       |-utils
>>          |- Logger.d // contains "module utils.Logger"
>>          |- Props.d //  contains "module utils.Props"
>>          |- utils.d //  contains "module utils;
>>                                   public import utils.Logger, 
>> utils.Props;"
>>
>> Then, i just 'import utils' in my code.
>>
>> Or would I have to have Logger.d in a directory called 
>> src/utils/Logger/Logger.d to be able to declare the module 
>> 'utils.Logger'?
>
> Not exactly. With given layout you will need to use "import 
> utils.utils;" in your code. There are no package imports in D 
> currently at all. Separating modules into directories is not 
> needed and will actually break everything. D module system maps 
> to file system entities. File is a module. Directory is a 
> package.

Ah ok, now I get it.

Thanks for that everyone. Ill test it out once I get home.

Cheers!

I saw the wiki entry posted earlier with recommendations for 
different module/package management, is there any plans to 
implement any of these changes do you know?


More information about the Digitalmars-d-learn mailing list