OT: static foreach

Max Samuha maxter at i.com.ua
Thu Nov 16 06:47:23 PST 2006


On Thu, 16 Nov 2006 09:50:35 +1100, Reiner Pope
<reiner.pope at REMOVE.THIS.gmail.com> wrote:

>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.

Thanks for the explanation. I need to dig deeper into the specs.



More information about the Digitalmars-d mailing list