Skip to content

Commit eed8e43

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 5e00af8 commit eed8e43

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
@@ -2307,7 +2307,8 @@ \subsection{Formal Parameters}
23072307
\Index{formal parameter list},
23082308
which consists of a list of required positional parameters
23092309
(\ref{requiredFormals}),
2310-
followed by any optional and/or named parameters (\ref{optionalFormals}).
2310+
followed by any optional and/or named parameters
2311+
(\ref{optionalFormalsAndNamedFormals}).
23112312
The latter may be specified
23122313
either as a list of optional positional parameters,
23132314
or as a set of named parameters,
@@ -2511,8 +2512,14 @@ \subsubsection{Required Formals}
25112512
an instance method, instance setter, or instance operator.
25122513

25132514

2514-
\subsubsection{Optional and Named Formals}
2515-
\LMLabel{optionalFormals}
2515+
\subsubsection{Optional Formals and Named Formals}
2516+
\LMLabel{optionalFormalsAndNamedFormals}
2517+
2518+
\LMHash{}%
2519+
This section is concerned with optional parameters,
2520+
positional or named,
2521+
and with required named parameters.
2522+
They are handled together because they share grammar rules.
25162523

25172524
\LMHash{}%
25182525
Optional formal parameters may be specified and provided with default values.
@@ -2524,7 +2531,7 @@ \subsubsection{Optional and Named Formals}
25242531

25252532
<defaultNamedParameter> ::= \gnewline{}
25262533
<metadata> \REQUIRED? <normalFormalParameterNoMetadata>
2527-
\gnewline{} (`:' <expression>)?
2534+
\gnewline{} (`=' <expression>)?
25282535
\end{grammar}
25292536

25302537
\LMHash{}%
@@ -2542,7 +2549,7 @@ \subsubsection{Optional and Named Formals}
25422549
\Error{compile-time error} if a required named parameter has a default value.
25432550

25442551
\LMHash{}%
2545-
Assume that $p$ is an optional named parameter with default value $d$.
2552+
Assume that $p$ is an optional parameter with default value $d$.
25462553
It is a \Error{compile-time error}
25472554
if the static type of $d$ is not assignable to the declared type of $p$.
25482555

0 commit comments

Comments
 (0)