Skip to content

Commit c2f6d39

Browse files
committed
Add a paragraph explaining that the given section is about both optional and named parameters, not just parameters that are both
1 parent d270bbf commit c2f6d39

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

specification/dartLangSpec.tex

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2240,7 +2240,8 @@ \subsection{Formal Parameters}
22402240
\Index{formal parameter list},
22412241
which consists of a list of required positional parameters
22422242
(\ref{requiredFormals}),
2243-
followed by any optional and/or named parameters (\ref{optionalFormals}).
2243+
followed by any optional and/or named parameters
2244+
(\ref{optionalFormalsAndNamedFormals}).
22442245
The latter may be specified
22452246
either as a list of optional positional parameters,
22462247
or as a set of named parameters,
@@ -2444,8 +2445,14 @@ \subsubsection{Required Formals}
24442445
an instance method, instance setter, or instance operator.
24452446

24462447

2447-
\subsubsection{Optional and Named Formals}
2448-
\LMLabel{optionalFormals}
2448+
\subsubsection{Optional Formals and Named Formals}
2449+
\LMLabel{optionalFormalsAndNamedFormals}
2450+
2451+
\LMHash{}%
2452+
This section is concerned with optional parameters,
2453+
positional or named,
2454+
and with required named parameters.
2455+
They are handled together because they share grammar rules.
24492456

24502457
\LMHash{}%
24512458
Optional formal parameters may be specified and provided with default values.
@@ -2457,7 +2464,7 @@ \subsubsection{Optional and Named Formals}
24572464

24582465
<defaultNamedParameter> ::= \gnewline{}
24592466
<metadata> \REQUIRED? <normalFormalParameterNoMetadata>
2460-
\gnewline{} (`:' <expression>)?
2467+
\gnewline{} (`=' <expression>)?
24612468
\end{grammar}
24622469

24632470
\LMHash{}%
@@ -2475,7 +2482,7 @@ \subsubsection{Optional and Named Formals}
24752482
\Error{compile-time error} if a required named parameter has a default value.
24762483

24772484
\LMHash{}%
2478-
Assume that $p$ is an optional named parameter with default value $d$.
2485+
Assume that $p$ is an optional parameter with default value $d$.
24792486
It is a \Error{compile-time error}
24802487
if the static type of $d$ is not assignable to the declared type of $p$.
24812488

0 commit comments

Comments
 (0)