order of static constructor execution
Walter Bright
newshound1 at digitalmars.com
Fri Mar 12 15:08:51 PST 2010
BCS wrote:
> Hello Walter,
>
>> Don wrote:
>>
>>> If that's true, then perhaps a more restricted solution is better.
>>> Eg, use Walter's proposal ONLY if the static initializer is mixed in.
>>>
>> I should note that all static constructors in a module are combined
>> into one function. So, the mixin static initializers are combined with
>> any other static initializers.
>>
>
> Does it have to run that way or could you lump them into several pieces
> and have them call each other as needed?
>
Right now, they are defined to run in lexical order. Regrouping them in
arbitrary orders will mess up intra-module ordering dependencies.
More information about the Digitalmars-d
mailing list