Skip to content

Commit df8a274

Browse files
authored
[spec] Define *FuncDeclaration* kinds (#3633)
Rename Grammar heading to Function Declarations. Also remove -preview=shortenedMethods note which is now the default. https://dlang.org/changelog/2.101.0.html#dmd.shortenedMethodsEnabled
1 parent 5cc64e6 commit df8a274

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

spec/function.dd

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ $(SPEC_S Functions,
44

55
$(HEADERNAV_TOC)
66

7-
$(H2 $(LNAME2 grammar, Grammar))
8-
9-
$(H3 Function declaration)
7+
$(H2 $(LNAME2 grammar, Function Declarations))
108

119
$(GRAMMAR
1210
$(GNAME FuncDeclaration):
@@ -24,7 +22,12 @@ $(GNAME FuncDeclaratorSuffix):
2422
$(GLINK2 template, TemplateParameters) $(GLINK Parameters) $(GLINK MemberFunctionAttributes)$(OPT) $(GLINK2 template, Constraint)$(OPT)
2523
)
2624

27-
$(H3 Parameters)
25+
* A *FuncDeclaration* with a $(GLINK FunctionBody) is called a *function definition*.
26+
* A *FuncDeclaration* with *TemplateParameters* defines a
27+
$(DDSUBLINK spec/template, function-templates, function template).
28+
29+
30+
$(H3 Function Parameters)
2831

2932
$(GRAMMAR
3033
$(GNAME Parameters):
@@ -76,7 +79,7 @@ $(NOTE In D2, declaring a parameter `final` is a semantic error, but not a parse
7679

7780
$(P See also: $(RELATIVE_LINK2 param-storage, parameter storage classes).)
7881

79-
$(H3 Function attributes)
82+
$(H3 Function Attributes)
8083

8184
$(GRAMMAR
8285
$(GNAME FunctionAttributes):
@@ -131,8 +134,6 @@ $(LEGACY_LNAME2 FunctionLiteralBody)
131134
$(DDSUBLINK spec/statement, ReturnStatement, return statement).
132135
This syntax also applies for $(DDSUBLINK spec/expression, function_literals, function literals).)
133136

134-
$(P $(B Note:) The *ShortenedFunctionBody* form requires the `-preview=shortenedMethods`
135-
command-line switch, which is available starting in v2.096.0.)
136137

137138
$(H3 $(LNAME2 function-declarations, Functions without Bodies))
138139

0 commit comments

Comments
 (0)