On Monday, 5 September 2016 at 12:15:35 UTC, dom wrote:
[...]
You misunderstood the error message and the lambda syntax (it
also happened to me the first time).
The grammar says that you can use one of these syntaxes:
1) `(arguments) {block of code}`
2) `(arguments) => expression`, which is equivalent to
`(arguments) {return expression;}`
3) `{block of code}`, which is equivalent to `(){block of code}`.
So if you write `(arguments) => {block of code}`, this is
equivalent to (see rule 2) `(arguments) { return {block of code};
}`.
And because of rule 3, it becomes `(arguments) { return (){block
of code} }`. So what you have is a function that returns a
function. That's why it does not match your signature.
The fact that the compiler also adds nothrow, @nogc, @safe is not
important in this case, as those attributes can be implicitly
casted away.