Fixing cyclic import static construction problems
Jonathan M Davis
jmdavisProg at gmx.com
Thu Nov 29 14:34:31 PST 2012
On Thursday, November 29, 2012 23:28:07 Timon Gehr wrote:
> On 11/29/2012 01:17 PM, Jonathan M Davis wrote:
> > In the past when I've brought up similar solutions, he's been completely
> > opposed to them. ...
>
> It is not a solution, it is a workaround.
What do you mean? The runtime sees circular dependencies between modules even
when there's no actual circular dependency between static constructors. We
need to fix that. One way is to just make the runtime not care, which wouldn't
be particularly safe. Another is to explicitly tell it that there are no such
dependencies. I don't see how that's not a solution. And unless someone can
come up with a way for the runtime to somehow determine on its own that
there's no actual, circular dependency, I don't see how anything better could
be done.
Granted, I think that having a single pragma for the whole module like Walter
is suggesting (as opposed to marking static constructors individually) is a
bad idea because of the silent breakage that it can cause, but the basic idea
is solid.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list