Cyclic depency with class static ctor
Kristian
kjkilpi at gmail.com
Mon Oct 30 03:15:54 PST 2006
On Mon, 30 Oct 2006 06:48:55 +0200, Walter Bright
<newshound at digitalmars.com> wrote:
> BCS wrote:
>> Walter Bright wrote:
>>>
>>> Yes. It isn't possible for the language to really determine the
>>> dependencies, so it plays it safe and tries to get all the static
>>> ctors run before the module(s) static ctors that import them. With
>>> cyclic imports and static ctors in those cycles, this is not possible.
>> If the rules were changed so that static this functions may only
>> depend on modules imported before them, then a lot of cases could be
>> made to work.
>
> I'd rather have fewer order dependencies, not more <g>.
Well, generally in programming things must be done in a specific order...
;)
What if some other syntax would be used to define the order of static
ctors?
For example:
import a, b, c;
after a: before c: static this();
More information about the Digitalmars-d
mailing list