Fixing cyclic import static construction problems

deadalnix deadalnix at gmail.com
Sat Dec 1 03:29:43 PST 2012


On Saturday, 1 December 2012 at 10:54:37 UTC, Artur Skawina wrote:
> 3) reading known initialized constant data works. That's 
> const/immutable/enum -
>    again, those can never become a RT dep.

const or immutable can be instanciated by another static ctor.

> 4) calling side-effect free code that does not depend on 
> non-local state works.
>    This is why an is-it-ctfeable check works - it will catch 
> even the indirect deps.
>    Yeah, it's conservative, but is has to be. A kind of 
> 'pure-but-w/o-external-refs"
>    thing would help further, but that can be added 
> incrementally and may not even
>    be necessary.
>

pure is probably enough. CTFEable is more restrictive.

>> have nothing even close to that. Regardless, while the 
>> compiler may be able
>> to provide additional information to the runtime, it's still 
>> the runtime that
>> needs to figure this out and not the compiler.
>

That is an undemonstrated assertion (and I think it is false).

> No. Would, at least, require going from per-module to 
> per-symbol which is a *much*
> larger change than was proposed here. I don't even want to 
> think about the (runtime)
> cost.
>

This reasonning is based on the assertion above, so is 
meaningless until the assertion is proven to be true.


More information about the Digitalmars-d mailing list