Working with modules

Dicebot m.strashun at gmail.com
Fri Feb 15 02:40:56 PST 2013


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.


More information about the Digitalmars-d-learn mailing list