Strategies for resolving cyclic dependencies in static ctors

Nick Sabalausky a at a.a
Mon Mar 21 17:16:03 PDT 2011


"Nick Sabalausky" <a at a.a> wrote in message 
news:im8pmp$18p7$1 at digitalmars.com...
>
> The pattern: The trick is to convert every variable that needs to be 
> initialized into an "init on first use" ref @property. This "ref 
> @property" checks a "hasThisBeenInited" bool and, if false, runs all the 
> initialization. If the variable is a reference type, then *sometimes* you 
> can get away with just checking for null (though often not, because it 
> will just get-reinited ).
>

...if anyone sets it to null.

(Forgot to finish that last sentence.) 




More information about the Digitalmars-d mailing list