Review of Andrei's std.benchmark

"Øivind" oivind.loe at gmail.com
Sat Sep 22 06:26:50 PDT 2012


On Saturday, 22 September 2012 at 13:03:06 UTC, Andrei 
Alexandrescu wrote:
> On 9/22/12 8:28 AM, "Øivind" wrote:
>> Is there a way to solve the dependency issue without 
>> forbidding static
>> constructors in modules with cyclic dependencies?
>
> I think an idea just occurred to me. The rules for static ctors 
> and dtors were invented before "import" was allowed inside a 
> scope. We could have taken advantage of that.
>
> Say we restrict symbol visibility inside static cdtors to ONLY 
> symbols within the current module. If some static cdtor needs a 
> symbol from a different module, it must import it explicitly 
> (even if the current module already imports it).
>
> In this setup it should be possible to compute, in a 
> fine-grained manner, the dependencies of static cdtors.
>
> Unfortunately that would be a breaking change.
>
>
> Andrei

It gets a bit ugly maybe, but we could do a mix of the proposals 
that have come before and this one, e.g. add a @nocycliccheck (or 
similar) to the static constructor,  and in that case only allow 
access to current module and those imorted inside the ctor scope..


More information about the Digitalmars-d mailing list