Library standardization

Edward Diener eddielee_no_spam_here at tropicsoft.com
Sun Apr 20 06:54:03 PDT 2008


Walter Bright wrote:
> Edward Diener wrote:
>> In D one of the negatives of having everything in a single .d file is 
>> that there is no separation between the declaration and the definition 
>> since the definition defines the declaration. Unfortunately this 
>> appears to lead to the fact that if the .d file changes then any other 
>> .d file which imports the original one ( has a dependency on the 
>> original one ) needs to be recompiled.
> 
> But it is quite possible to separate D modules into "headers" and 
> "implementations", if desired. Phobos does this for the gc, for example.
> It can also be done automatically by generating .di files.

Is there an example of code separated into "headers" and 
"implementation" ? I do not realize how this can be done. Can one just 
declare a D function or class in a "header" and then import that file 
and provide an implementation for what had previously just been declared 
? What about templates ? I do not see how a D template can just be 
declared in one .d file and then implemented in another .d file.

Where in the documentation are .di files described ? I recall reading 
something about .di files somewhere, probably in the spec, but I can no 
longer find it.



More information about the Digitalmars-d mailing list