Skip to content

Instantly share code, notes, and snippets.

@sgraf812 sgraf812/a.d
Created Jan 22, 2019

Embed
What would you like to do?
Circular module dependencies in D
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));
}
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
You can’t perform that action at this time.