Working with modules

Colin Grogan grogan.colin at gmail.com
Fri Feb 15 01:51:00 PST 2013


Hi all,

I have a question regarding how to lay out my code.

I wish to have a project directory structure that resembles java 
projects (As I'm comfortable working in that sort of environment

For example:
$PROJHOME
     |-/src     <- Source code
     |-/lib     <- third party libraries
     |-/bin     <- Compiled binaries
     |-build.sh <- script to build my project and stick the binary 
into 'bin' directory

So, my src directory is where all my source code is going. Under 
source code, im going to have a few different folders.

This is where my problem occurs. To illustrate:
$PROJHOME
     |-/src
         |- utils
              |- Logger.d
              |- Properties.d
              |- SSHTool.d
         |- engine

I want to put Logger.d, Properties.d and SSHTool.d into the 
module 'utils'. However, D's module system wont allow that, keeps 
throwing back errors to me saying 'utils' is conflicting (or 
something similar, cant remember the exact error).
So, I've done a bit of reading, and found out that I should put 
all those classes into once source file, and put that file in the 
module 'utils'.
Now, thats all fine and dandy, but I expect by the end of this 
experiment I will have quite a lot of utility classes and I 
really dont want them all in one source file. It becomes unwieldy 
imo.

Does anyone here have any alternatives for me so that in my 
'engine' or 'main' classes I can simply write:

     import utils;

and still have my source files neatly laid out in manageable 
chunks?

Thanks in advance...


More information about the Digitalmars-d-learn mailing list