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))
2327
2327
---
2328
2328
)
2329
2329
2330
- $(H4 $(LNAME2 lambda-short-syntax, Short Syntax))
2330
+ $(H4 $(LNAME2 lambda-short-syntax, Nullary Short Syntax))
2331
2331
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:
2334
2347
2335
2348
$(SPEC_RUNNABLE_EXAMPLE_RUN
2336
2349
-------------
@@ -2351,6 +2364,9 @@ $(H4 $(LNAME2 lambda-short-syntax, Short Syntax))
2351
2364
}
2352
2365
-------------
2353
2366
)
2367
+ )
2368
+
2369
+ $(H4 $(LNAME2 lambda-short-body, Shortened Body Syntax))
2354
2370
2355
2371
$(P The syntax $(D => AssignExpression) is equivalent to $(D { return AssignExpression; }).)
2356
2372
You can’t perform that action at this time.
0 commit comments