Adding empty static this() causes exception
Biotronic via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Sep 12 03:29:41 PDT 2017
The simplest example of a cycle is probably this:
module A;
import B;
int n1 = 17;
static this() {
n1 = n2;
}
//
module B;
import A;
int n2 = 42;
static this() {
n2 = n1;
}
What's the value of n1 and n2 after module constructors are run?
Since both module constructors can run arbitrary code, it's
impossible to prove in the general case whether one of them
depends on the other.
--
Biotronic
More information about the Digitalmars-d-learn
mailing list