On Tuesday, 28 April 2020 at 20:48:57 UTC, Net wrote:
() { ... } ();

Is there a name of this kind of function in D? unnamed? anonymous?

The spec uses "anonymous". Syntactically, `() { ... }` is a function literal.

There is a section called "Anonymous Functions and Anonymous Delegates" [1], but it's just a link to "Function Literals":

https://dlang.org/spec/expression.html#function_literals

To be clear, the second set of parentheses in `() { ... } ()` just calls the anonymous function. You could equivalently write it like this:

    alias f = () { ... };
    f();


[1] https://dlang.org/spec/function.html#anonymous

Reply via email to