How to break module into multiple file.

Timon Gehr timon.gehr at gmx.ch
Mon May 23 00:58:28 PDT 2011


On 2011-05-23 00:09, Matthew Ong wrote:
> On 5/21/2011 7:16 PM, Russel Winder wrote:
> > On Sat, 2011-05-21 at 04:35 -0400, Nick Sabalausky wrote:
> > [ . . . ]
> >
> >> Subversion handles multiple people editing the same file perfectly fine.
> >> But Hg probably is better than SVN, overall. I've been a happy SVN user
> >> for a long time, but even I'm starting to get won over by Hg. Of
> >> course, some people like Git better than Hg (and some people like Hg
> >> better than Git).
> >
> > And there is also Bazaar.
>
> overall this method of D file layout is because of ability to use some
> sort of Source Control and not because of D cannot compile???
>
> Funny...But going to be hard sell to management level people from the QA
> side that does not do coding.

If you really really need it, D supports textual inclusion too, but it is more
explicit about it:

mixin(import("file.d")); //or maybe you even want to use another extension, so
that the compiler does not recognize the files as own modules.

So you actually can break up your module into multiple files, if you have no other
choice. You would then have one source file that represents the module and just
includes all the other modules. But this is a hack and has most problems of
textual inclusion. Don't do it.

A better way to handle it: You can also just have one module per person and have
the top module publicly import all of them. Why do you seem to not want to do this?

Timon


More information about the Digitalmars-d-learn mailing list