OT: static foreach

Reiner Pope reiner.pope at REMOVE.THIS.gmail.com
Wed Nov 15 14:50:35 PST 2006


Max Samuha wrote:
> On Wed, 15 Nov 2006 11:05:02 +0100, "John S. Skogtvedt"
> <jss2k2 at chello.no> wrote:
> 
> Why 'foreach' and not 'static foreach' is used for compile time
> iteration unlike 'static if' for compile time condition evaluation? Or
> is 'static' necessary in 'static if' at all? Can't the compiler
> determine whether 'if' is static based on the compile time
> evaluability of the expression?
The important difference between 'static if' and 'if' is that 'static 
if' doesn't create a new scope, whereas 'if' does. The compile-time vs 
runtime dichotomy is just a consequence of that; deferring handling of 
different scopes to runtime is just too complex.



More information about the Digitalmars-d mailing list