-
-
Save sgraf812/24f7161b3bebd6fef90897bae911597a to your computer and use it in GitHub Desktop.
Circular module dependencies in D
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module a; | |
import b; | |
import std.stdio; | |
struct Flip { Flop* p; } | |
auto flip(int i) { | |
if (i == 0) return null; | |
auto f = new Flip; | |
f.p = flop(i-1); | |
return f; | |
} | |
void main() { | |
writefln("Hi %s", *flip(3)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module b; | |
import a; | |
struct Flop { Flip* p; } | |
auto flop(int i) { | |
if (i == 0) return null; | |
auto f = new Flop; | |
f.p = flip(i-1); | |
return f; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment