How to break module into multiple file.
Jonathan M Davis
jmdavisProg at gmx.com
Thu May 12 15:59:34 PDT 2011
> On 12.05.2011 20:34, Jonathan M Davis wrote:
> > It's generally easy for _you_ to find them too, because the import tells
> > you where they are (the fact that you can have multiply directories
> > being searched for imports being the main complicating factor). It's
> > what pretty much any D programmer will expect. Doing anything else will
> > just cause confusion.
>
> For those who are started with D, or had something similar before -
> probably.
>
> But not for all people this is natural way to handle their sources. In
> general, I agree, the reasoning is good enough - I follow it.
>
> One thing though is really annoying (to me, at least) with this binding
> to file name - if file is named with dashes, compiler wouldn't find it by
> itself. For those who prefer underscores this is not a problem, of course.
Dashes aren't legal in module names, because they're not legal in indentifier
names. However, if you insist on naming your files that way for whatever
reason, you can always put dashes in the file name and just name the module
appropriately with the module statement at the top of the file. As long as the
names are close (like the module name with underscores and the file with
dashes), it shouldn't pose much problem for programmers, and the compiler can
find them just fine. Still, I wouldn't have though that dashes would have been
a big enough deal to really care. I would have thought that you'd name the
module whatever made sense for the code and then just name the file
accordingly. However, the module statement does allow you to make them not
match if you really want to, so that situtation has been designed for.
- Jonathan M Davis
More information about the Digitalmars-d-learn
mailing list