Skip to content

Commit 263147a

Browse files
ntreldlang-bot
authored andcommitted
[spec] Tweak function docs
*Short* function literals are known as lambdas. Use list for description and add item for omitted lambda parameter types. function.dd: Merge two variants of ParameterList grammar using OPT. template.dd: Change alias kind to function literal, (not just lambda).
1 parent d297204 commit 263147a

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

spec/expression.dd

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2083,16 +2083,18 @@ $(GNAME RefOrAutoRef):
20832083
$(D auto ref)
20842084
)
20852085

2086-
$(P $(I FunctionLiteral)s (also known as $(LNAME2 lambdas, $(I Lambdas))) enable embedding anonymous functions
2086+
$(P $(I FunctionLiteral)s enable embedding anonymous functions
20872087
and anonymous delegates directly into expressions.
2088-
$(I Type) is the return type of the function or delegate -
2088+
Short function literals are known as $(LNAME2 lambdas, $(I lambdas)).
2089+
)
2090+
* $(I Type) is the return type of the function or delegate -
20892091
if omitted it is $(RELATIVE_LINK2 lambda-return-type, inferred).
2090-
$(I ParameterWithAttributes) or $(I ParameterWithMemberAttributes)
2092+
* $(I ParameterWithAttributes) or $(I ParameterWithMemberAttributes)
20912093
can be used to specify the parameters for the function. If these are
20922094
omitted, the function defaults to the empty parameter list $(D ( )).
2093-
The type of a function literal is a
2095+
* Parameter types can be $(RELATIVE_LINK2 lambda-parameter-inference, omitted).
2096+
* The type of a function literal is a
20942097
$(DDSUBLINK spec/function, closures, delegate or a pointer to function).
2095-
)
20962098

20972099
$(P For example:)
20982100

spec/function.dd

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ $(GNAME Parameters):
3232

3333
$(GNAME ParameterList):
3434
$(GLINK Parameter)
35-
$(GLINK Parameter) $(D ,)
36-
$(GLINK Parameter) $(D ,) $(GSELF ParameterList)
35+
$(GLINK Parameter) $(D ,) $(GSELF ParameterList)$(OPT)
3736
$(GLINK VariadicArgumentsAttributes)$(OPT) $(D ...)
3837

3938
$(GNAME Parameter):

spec/template.dd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -784,7 +784,7 @@ $(H4 $(LNAME2 alias_value, Value Aliases))
784784
------
785785
))
786786

787-
$(LI Lambdas
787+
$(LI Function Literals
788788
$(SPEC_RUNNABLE_EXAMPLE_COMPILE
789789
------
790790
template Foo(alias fun)

0 commit comments

Comments
 (0)