Why don't lazy parameters bind to delegates? Was: Feature to get or add value to an associative array.
Giles Bathgate
giles.bathgate at gmail.com
Fri Apr 20 23:21:33 UTC 2018
On Friday, 20 April 2018 at 23:13:58 UTC, Jonathan M Davis wrote:
> Yes. That should work. e.g. this
>
> import std.stdio;
>
> void foo(lazy string l)
> {
> }
>
> void main()
> {
> foo({writeln("foo"); return "str";}());
> }
>
> compiles and runs just fine without printing anything, whereas
> you get a compilation error if you don't have the parens after
> the closing brace.
Ok cool. I've updated the PR since basically, I agree with your
points about it being confusing to cater for the special case.
More information about the Digitalmars-d
mailing list