File tree Expand file tree Collapse file tree 1 file changed +19
-3
lines changed Expand file tree Collapse file tree 1 file changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -2327,10 +2327,23 @@ $(H4 $(LNAME2 lambda-return-type, Return Type Inference))
23272327 ---
23282328 )
23292329
2330- $(H4 $(LNAME2 lambda-short-syntax, Short Syntax))
2330+ $(H4 $(LNAME2 lambda-short-syntax, Nullary Short Syntax))
23312331
2332- $(P Anonymous delegates can behave like arbitrary statement literals.
2333- For example, here an arbitrary statement is executed by a loop:)
2332+ $(P *Parameters* can be omitted completely for a function literal
2333+ when there is a *BlockStatement* function body.)
2334+
2335+ $(NOTE This form is not allowed to be immediately called as an *ExpressionStatement*,
2336+ because it would require arbitrary lookahead to distinguish it from a *BlockStatement*.)
2337+
2338+ ---
2339+ auto f = { writeln("hi"); }; // OK, f has type `void function()`
2340+ f();
2341+ { writeln("hi"); }(); // error
2342+ () { writeln("hi"); }(); // OK
2343+ ---
2344+
2345+ $(PANEL Anonymous delegates can behave like arbitrary statement literals.
2346+ For example, here an arbitrary statement is executed by a loop:
23342347
23352348 $(SPEC_RUNNABLE_EXAMPLE_RUN
23362349 -------------
@@ -2351,6 +2364,9 @@ $(H4 $(LNAME2 lambda-short-syntax, Short Syntax))
23512364 }
23522365 -------------
23532366 )
2367+ )
2368+
2369+ $(H4 $(LNAME2 lambda-short-body, Shortened Body Syntax))
23542370
23552371 $(P The syntax $(D => AssignExpression) is equivalent to $(D { return AssignExpression; }).)
23562372
You can’t perform that action at this time.
0 commit comments