Empty functions

Paul Backus snarwin at gmail.com
Thu Oct 29 12:14:53 UTC 2020

On Thursday, 29 October 2020 at 09:06:21 UTC, Jan Hönig wrote:
> On Thursday, 29 October 2020 at 09:01:12 UTC, Jan Hönig wrote:
>> This would mean, that this one should work as well.
> It does not work as I intended, as `() => {}` has not the 
> return type of `void`.
> (I don't know how to print: `ReturnType!(() => {})`)

Arrow lambdas take a single *expression* on the right-hand side, 
not a function body between curly braces. When you write

     () => {}

the right-hand side is interpreted as an expression, and is 
expanded by the compiler to

     () => function void() {}

I.e., it is a function that returns another function.

More information about the Digitalmars-d-learn mailing list