Greetings.

The following code works:

void main() {
    passfunc(&func);
}

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 would get the compiler error "Delegate f () is not callable using argument types (string)". I can lazily pass a void function() -- it seems that there is only a problem when the function contains parameters.

The only difference should be when the pointer is evaluated, so why does lazy evaluation matter here?

Thank you for your time
--Ryan

Reply via email to