In what order static if conditions are evaluated?

Timon Gehr timon.gehr at gmx.ch
Thu Mar 28 11:30:55 PDT 2013


On 03/28/2013 12:52 PM, Don wrote:
> ...
>
> Yes, it currently evaluates it top to bottom. An algorithm has been
> discussed which would remove that restriction;

I'm not sure that restriction is the correct word. There is not always a 
well-defined top-to-bottom order.

>  your example would then compile. It's difficult to implement though.

It was rather easy to implement. Do you mean it might be hard to fit it 
into the existing DMD code base?

> It has to deal with paradoxes:
>
> static if (!is(typeof(x)) int y = 1;
> static if (!is(typeof(y)) int x = 1;
>
> Who wins?
>

Nobody. :o)


More information about the Digitalmars-d mailing list