modules

Bruno Medeiros brunodomedeirosATgmail at SPAM.com
Mon May 1 03:01:13 PDT 2006


James Pelcis wrote:
> As I understand it, the documentation is referring to the default module 
> name.  If you felt like it, you could do something like the following:
> 
> test1.d
>     module blah;
> 
>     private import std.stdio;
> 
>     void print (char[] data) {
>         writefln(data);
>     }
> 
> test2.d
>     import blah;
> 
>     void main () {
>         print("This was successful.");
>     }
> 
> This can confuse build though, I think.
> 

Whoa! I for long explicitly thought this wasn't possible, and I guess I 
wasn't the only one. Still, it seems like a borderline (perhaps even 
non-recommendable?) idiom.
(To do separate compilation with this one needs to manually use header 
files).


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



More information about the Digitalmars-d-learn mailing list