Thanks.  It would still be nice to see full "static foreach" functionality so 
that, as you pointed out, it can be used outside of functions, to add member 
variables to a struct, for instance.   I know people have been using m4 with C 
to achieve compile-time loops and branches.  D's "static if" is vastly superior 
to m4 because it has access to typeinfo and routines written in D.

I'm a little confused, though, why the author chose to overload "foreach" to 
either be a runtime loop or a compile-time loop based on whether its looping 
over a tuple or not.  It seems it would be more readable to have "static 
foreach" and simply put a caveat that it's only supported inside functions for 
now.

Reply via email to