On Thursday, 16 February 2023 at 04:11:03 UTC, Walter Bright wrote:
>Some methods given A imports B and B imports A:
- Break up A and B so that the common part goes in C. The static constructor goes in C. I don't have the math to prove it, but I'm pretty sure that any A<=>B can be replaced with A<=C and B<=C. In fact, I think Go requires it (does not allow cyclical imports).
You can always break import cycles by combining A and B into a new module C.
Then, as an extra step, sometimes some parts of C can be split out into separate modules A and B again. :)