In what order static if conditions are evaluated?

Timon Gehr timon.gehr at gmx.ch
Fri Mar 29 07:01:57 PDT 2013


On 03/29/2013 04:22 AM, deadalnix wrote:
> On Thursday, 28 March 2013 at 18:24:19 UTC, Timon Gehr wrote:
>> Yes; DMD is buggy and the specification is insufficient. Currently the
>> meaning of D code as interpreted by DMD may depend on the order the
>> modules are passed to the compiler on the command line.
>>
>
> Can you have a look at http://wiki.dlang.org/DIP31 ?
>
> I have written a proposal to specify this, but it does currently not
> precise/complete enough.

Poisoning is the right approach. However, the analysis order should be 
the order of potential dependencies between mixin expressions/static if 
conditions and potentially generated symbols. In case there is a cycle 
in the potential dependencies, the symbol lookups occuring in the 
connected component that appears first in a topological ordering of all 
connected components of the potential-dependency graph should poison the 
respective scopes. Analysis can then proceed, because the potential 
dependencies on the cycle are eliminated.

It is possible that your way of dealing with overloads is fine, however, 
I'd just have poisoned those overloads that would necessitate revisiting 
an already taken overload-resolution decision.


More information about the Digitalmars-d mailing list