On 01/11/2010 16:20, Jonathan M Davis wrote:
1. I 'm stunned that the compiler doesn't complain about you declaring f as
void. It strikes me as a bug with lazy. You can't declare variables of type
void. It makes no sense.
It isn't a bug. Read the documentation on lazy - D explicitly supports
On 01/11/2010 15:57, Adam Cigánek wrote:
void capture(lazy void f) {
fun =&f;
}
It says "Error: lazy variables cannot be lvalues", pointing to the
"fun =&f" line.
Because f doesn't have an address. It's just an expression that's
evaluated where it's used. It's true that the fu
On Monday, November 01, 2010 08:57:09 Adam Cigánek wrote:
> Hello,
>
> why is the following code illegal?
>
>
> import std.stdio;
>
> void delegate() fun;
>
> void capture(lazy void f) {
> fun = &f;
> }
>
> void main() {
> capture(writeln("hello"));
> fun();
> }
>
>
Hello,
why is the following code illegal?
import std.stdio;
void delegate() fun;
void capture(lazy void f) {
fun = &f;
}
void main() {
capture(writeln("hello"));
fun();
}
It says "Error: lazy variables cannot be lvalues", pointing to the
"fun = &f" line.
It can be w