On Sunday, 10 April 2016 at 19:02:06 UTC, Alex Parrill wrote:
A parameter declared as `lazy T` has the type `T delegate()`,
which, when called, evaluates the expression that was passed
into the function.
So effectively, this:
void foo(lazy int x) { auto i = x(); }
foo(a+b);
Is the same as
On Sunday, 10 April 2016 at 18:08:58 UTC, Ryan Frame wrote:
Greetings.
The following code works:
void main() {
passfunc();
}
void passfunc(void function(string) f) {
f("Hello");
}
void func(string str) {
import std.stdio : writeln;
writeln(str);
}
Now if I change passfunc's
Greetings.
The following code works:
void main() {
passfunc();
}
void passfunc(void function(string) f) {
f("Hello");
}
void func(string str) {
import std.stdio : writeln;
writeln(str);
}
Now if I change passfunc's signature to "void passfunc(lazy void
function(string) f)" I