www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Re: static foreach

bearophile Wrote:
 [Later if Walter finds a way to implement, the static foreach can be made
richer, for example letting the compiler translate "static foreach (i; 10 ..
20)" in a "static foreach (i; Range!(10, 20))". And even later if Walter is
able the whole thing can be allowed outside functions.]

I like the idea of having an intermediate solution like that. D1 currently supports "foreach(i; Range!(10,20))" inside functions and so a quick solution is to allow "static foreach(i; Range!(10,20))" and "static foreach(i; 10..20)" inside functions.
Mar 28 2010