Compile time and runtime grammars
    Ali Çehreli via Digitalmars-d-learn 
    digitalmars-d-learn at puremagic.com
       
    Sat Oct 10 16:46:40 PDT 2015
    
    
  
On 10/10/2015 12:43 PM, H. S. Teoh via Digitalmars-d-learn wrote:
 > On Sat, Oct 10, 2015 at 06:52:29PM +0000, DLangLearner via 
Digitalmars-d-learn wrote:
 >> 1. There are confusing keywords:
To OP: I am glad that you are not bothered with compile-time foreach. ;)
 > The "static" in "static if" is clear indication that this isn't a
 > regular if-statement, but a branch that's taken at compile-time. I'm not
 > sure how else it can be made clearer.
I would make curly brackets mandatory for the static if block and its 
else block. The following is almost always wrong:
static if (cond) {
     // ...
} else if {    // Oops! Inserting a run-time if
     // ...
}
If that was really intended, they would have to use curly brackets:
} else {    // <-- could be required
     if {
         // ...
     }
}
Ali
    
    
More information about the Digitalmars-d-learn
mailing list