How to break module into multiple file.

Jonathan M Davis jmdavisProg at gmx.com
Mon May 23 00:21:58 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.

You must work at a fairly odd place if management and the QA people even care 
whether multiple people edit a file simultaneously. C, C++, and many other 
languages allow you to put pretty much anything you want in a file and allow 
you to organize your code however you like. The fact that Java restricts you 
to a single public class per file is quite abnormal. Sure, if you use a source 
control system which is poor enough that it won't allow multiple people to 
edit a file simultaneously, then having a lot of code in a single file could 
be a problem, but people have worked with horrible source control systems like 
Visual Source Safe which had such restrictions and still used languages like C 
and C++ with them. So, even if your SC software sucks, you can use D with it 
just fine. It's just more pleasant when your SC software doesn't suck.

D is organized the way it is because it makes sense. D was designed by C and 
C++ programmers who found it perfectly normal to split up files however you 
wanted to. But D improves over C and C++ immensely by using a proper module 
system rather than textual inclusion.

I really don't understand why you're hung up on this idea that you need to 
only have one person working on a module at a time and think that the fact 
that the programming language doesn't enforce that you can't have more than 
one public class per file is a bad thing. Most languages and programming 
environments just don't work that way.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list