Throw away value in lambda expression
Submitted by Christian Johnson
Link to original bug (#730971)
Description
Consider the fallowing code.
delegate void LambdaFunc (int a, int b);
void main() { LambdaFunc l = (a, b) => { stdout.printf("%d\n", a); }; }
The delegate defines two ints a and b but the lambda has no need of b. I run into this all the time, where a lambda provides more information than I need. I propose to allow _ to throw away a value. So in the fallowing code
delegate void LambdaFunc (int a, int b);
void main() { LambdaFunc l = (a, _) => { stdout.printf("%d\n", a); }; }
the second variable is never given a value but still calls LambdaFunc.