On 9/22/12 8:28 AM, "Øivind" wrote:
Is there a way to solve the dependency issue without forbidding static constructors in modules with cyclic dependencies?
I think an idea just occurred to me. The rules for static ctors and dtors were invented before "import" was allowed inside a scope. We could have taken advantage of that.
Say we restrict symbol visibility inside static cdtors to ONLY symbols within the current module. If some static cdtor needs a symbol from a different module, it must import it explicitly (even if the current module already imports it).
In this setup it should be possible to compute, in a fine-grained manner, the dependencies of static cdtors.
Unfortunately that would be a breaking change. Andrei