Re: lazy variables cannot be lvalues - why?

2010-11-01 Thread Stewart Gordon
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

Re: lazy variables cannot be lvalues - why?

2010-11-01 Thread Stewart Gordon
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

Re: lazy variables cannot be lvalues - why?

2010-11-01 Thread Jonathan M Davis
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(); > } > >

lazy variables cannot be lvalues - why?

2010-11-01 Thread Adam Cigánek
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