Fixing cyclic import static construction problems

Walter Bright newshound2 at digitalmars.com
Thu Nov 29 15:02:18 PST 2012


On 11/30/2012 9:43 AM, Walter Bright wrote:
> It is possible for each static constructor to specify independently of
> the other static constructors which imports must be constructed first.
> But do we really want to go that far?

One way to do that might be to borrow syntax from classes:

    static this() : std.stdio, a, c
    {
        ...
    }

and the  this static constructor only requires that modules std.stdio, 
a, and c be constructed first.

    static this() : void
    {
        ...
    }

means it has no dependencies on other imports.

    static this()
    {
       ...
    }

has the current behavior (all imported modules must be constructed first).



More information about the Digitalmars-d mailing list