Lazy with anonymous methods

Hi,
Would it be possible to use lazy with anonymous methods ? I would like to do something like

property SomeValue:Integer := begin exit 1; end; lazy;

Thanks,
John

You could do something like:

property SomeValue:Integer := (method begin exit 1; end)(); lazy;

Presuming the end goal is to have a multi statement initializer.

1 Like

I didn’t realize I could do that. Thanks.

It’s a combination of two features really. Anonymous methods, and calls. The compiler reduces this to a regular statement, IF the anonymous method has no parameters and the call is done right on that.