Take the following code for example module test; import std.stdio;
void test(T...)(lazy T args) { foreach(arg;args) //bar is invoked here { writeln("about to process arg");writefln("processing arg %s",arg); //but it should be invoked here, right?
} } int bar() { writeln("bar invoked"); return 1; } void main() { test(bar()); }shouldn't bar be evaluated when writefln is called, not at the start of the loop.