how to avoid "cycle detected"?
Steven Schveighoffer via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Jul 2 03:56:26 PDT 2015
On 7/1/15 6:25 PM, Jonathan M Davis via Digitalmars-d-learn 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.
With RTInfo for modules, we don't need any additional language support.
In Dconf '14, Walter said it was a good idea to add the RTInfo support
for modules. I don't know if he voiced an opinion on the usage of it for
flagging whether the static ctors are all standalone.
But with support for modifying the runtime to reflect compile-time
traits, we can at least play around with it.
There are some things that are so obviously not dependent on anything
(like initializing an AA), it's really quite annoying to have the
runtime conservatively flag those as error.
-Steve
More information about the Digitalmars-d-learn
mailing list