lazy variables cannot be lvalues - why?

Stewart Gordon smjg_1998 at yahoo.com
Mon Nov 1 10:17:24 PDT 2010


On 01/11/2010 16:20, Jonathan M Davis wrote:
<snip>
> 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.
<snip>

It isn't a bug.  Read the documentation on lazy - D explicitly supports 
it.  It's a way of accepting an arbitrary expression as a function 
parameter and then controlling when and how often that expression is 
evaluated.

Stewart.


More information about the Digitalmars-d-learn mailing list