Why the compiler dosen't enforce correct module declarations?

Bruno Medeiros brunodomedeiros+spam at com.gmail
Sat May 26 08:39:41 PDT 2007


Sean Kelly wrote:
> Ary Manzana wrote:
>>
>> Shouldn't the compiler say "Wait, you are saying that module one is in 
>> file main.d, module two is in other.d and module lala.la is in 
>> dir/some_other.d, this isn't quite well"?
> 
> I've decided that this is actually a good thing.  It allows large 
> modules to be split across multiple files and for different 
> implementation files to be chosen at compile time when using the 
> header/source model.  It's also the only way I've found to compile the 
> implementation of "object.d" for Tango.  Actually naming it "object.d" 
> caused all sorts of problems.
> 
> 
> Sean

But:
A) "It allows large modules to be split across multiple files"
What do you mean? Splitting a large module into multiple files implies 
putting each new file in a different module. What does that have to do 
with allowing module-file name mismatches?
B) "and for different implementation files to be chosen at compile time 
when using the header/source model."
And why is that a good thing? If I use conditional compilation and 
define conditional properties at compile time I achieve the same effect.

-- 
Bruno Medeiros - MSc in CS/E student
http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D


More information about the Digitalmars-d-learn mailing list