static if - is the 'static' really needed?

Jesse Phillips Jesse.K.Phillips+D at gmail.com
Fri Dec 13 07:35:02 PST 2013


On Friday, 13 December 2013 at 12:10:02 UTC, comco wrote:
> Imagine a world in which a simple 'if' has the semantics of a 
> static if, if the condition is evaluable at CT. Is this a world 
> you would rather live in?
>
> template Fac(int i) {
> if (i == 0) { // static if; doesn't introduce scope
> enum Fac = 1;
> } else {
> enum Fac = i * Fac!(i-1);
> }
> }

I would not rather live in it. I would rather live in:

     static foreach(...) // but that hasn't happened yet.


More information about the Digitalmars-d-learn mailing list