I've been reading the newsgroup for a while, and it seems that one of the reason folks like D is because it supports module.

My question is: what does module mean?
A quick google pointed my this page: http://dlang.org/module.html.
Still cannot understand it, though :)

How does it differ from the old C's #include?

For example, consider the hello world in C.

#include <stdio.h>

int main(void){
        printf("%s\n", "Hello world...");
        return 0;
}

The C preprocessor while replace the line "#include <stdio.h>" with the content of stdio.h itself.

While in D:

import std.stdio;

void main(){
        writeln("Hello world...");
}

Does that mean the compiler take the "definition" of writeln itself from stdio.d and paste it into my program? Pardon my ignorance, because I'm not versed in compiler theory.

Reply via email to