more cyclical confoundedness

Ellery Newcomer ellery-newcomer at utulsa.edu
Sun Apr 5 20:47:18 PDT 2009


Hello.

When I have three files test1.d test2.d test3.d as follows:

module test1;
import tango.io.Stdout;
import test3;
static this(){
     Stdout("test1\n");
}


module test2;
import test1;
//no ctor


module test3;
import tango.io.Stdout;
import test2;
static this(){
     Stdout("test3\n");
}


and main.d:

module main;
import tango.io.Stdout;
import test1;
import test2;
import test3;
main(){}
static this(){
     Stdout("main\n");
}


It works dandy, compiling AND running to give me

test3
test1
main

But if I change the import order to begin with

import test3;

it barfs with the cyclic dependency runtime error. All other 
combinations give output same as the first.

Now, what the heck is going on? As near as I can tell these should all 
fail at runtime. Or am I missing something?


More information about the Digitalmars-d-learn mailing list