What is the difference between "delegate()" and "lazy delegate()" ?

frame frame86 at live.com
Sat Jan 2 18:42:28 UTC 2021


On Saturday, 2 January 2021 at 12:29:43 UTC, Marcone wrote:
> Why "lazy delegate()" need two parentheses to execute function?

AFAIK is 'lazy' some kind of delegate storage class which accept 
an expression to execute. The reason you can actually use the 
parameter without "()" is just CTFE sugar which calls it 
automatically on use.

On the other hand, if you supply a 'lazy delegate()' the compiler 
does not know to call only the lazy expression or the delegate 
itself.




More information about the Digitalmars-d-learn mailing list