Skip to content

Commit 3ec7548

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 fa6e2b8 commit 3ec7548

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
@@ -2245,7 +2245,8 @@ \subsection{Formal Parameters}
22452245
\Index{formal parameter list},
22462246
which consists of a list of required positional parameters
22472247
(\ref{requiredFormals}),
2248-
followed by any optional and/or named parameters (\ref{optionalFormals}).
2248+
followed by any optional and/or named parameters
2249+
(\ref{optionalFormalsAndNamedFormals}).
22492250
The latter may be specified
22502251
either as a list of optional positional parameters,
22512252
or as a set of named parameters,
@@ -2449,8 +2450,14 @@ \subsubsection{Required Formals}
24492450
an instance method, instance setter, or instance operator.
24502451

24512452

2452-
\subsubsection{Optional and Named Formals}
2453-
\LMLabel{optionalFormals}
2453+
\subsubsection{Optional Formals and Named Formals}
2454+
\LMLabel{optionalFormalsAndNamedFormals}
2455+
2456+
\LMHash{}%
2457+
This section is concerned with optional parameters,
2458+
positional or named,
2459+
and with required named parameters.
2460+
They are handled together because they share grammar rules.
24542461

24552462
\LMHash{}%
24562463
Optional formal parameters may be specified and provided with default values.
@@ -2462,7 +2469,7 @@ \subsubsection{Optional and Named Formals}
24622469

24632470
<defaultNamedParameter> ::= \gnewline{}
24642471
<metadata> \REQUIRED? <normalFormalParameterNoMetadata>
2465-
\gnewline{} (`:' <expression>)?
2472+
\gnewline{} (`=' <expression>)?
24662473
\end{grammar}
24672474

24682475
\LMHash{}%
@@ -2480,7 +2487,7 @@ \subsubsection{Optional and Named Formals}
24802487
\Error{compile-time error} if a required named parameter has a default value.
24812488

24822489
\LMHash{}%
2483-
Assume that $p$ is an optional named parameter with default value $d$.
2490+
Assume that $p$ is an optional parameter with default value $d$.
24842491
It is a \Error{compile-time error}
24852492
if the static type of $d$ is not assignable to the declared type of $p$.
24862493

0 commit comments

Comments
 (0)