how to avoid "cycle detected"?

aki via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Jul 2 00:10:54 PDT 2015


On Wednesday, 1 July 2015 at 22:25:48 UTC, Jonathan M Davis wrote:
> On Wednesday, July 01, 2015 08:52:38 Steven Schveighoffer via 
> Digitalmars-d-learn wrote:
>> The runtime cannot introspect the code to detect the circular 
>> dependency, so it makes a conservative decision. I'm waiting 
>> on an introduction of RTInfo for modules [1] to allow us to 
>> mark static ctors as standalone, then we can probably fix this 
>> problem through a sort of "trust the programmer" mechanism.
>
> I wouldn't mind that, but Walter shot that idea down previously 
> when I was arguing for adding a way to the language to tell the 
> compiler that a static constructor didn't depend on anything 
> else. He didn't want a "trust the programmer" mechanism in this 
> case. I don't remember what his arguments were though.
>
> - Jonathan M Davis

Thanks for the discussion, now I understand there are
technical difficulties.
I have to give it a name like void staticInit(); and
call it manually from main().

aki.



More information about the Digitalmars-d-learn mailing list