Skip to content

Commit 5ac887e

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 ba769d4 commit 5ac887e

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
@@ -2298,7 +2298,8 @@ \subsection{Formal Parameters}
22982298
\Index{formal parameter list},
22992299
which consists of a list of required positional parameters
23002300
(\ref{requiredFormals}),
2301-
followed by any optional and/or named parameters (\ref{optionalFormals}).
2301+
followed by any optional and/or named parameters
2302+
(\ref{optionalFormalsAndNamedFormals}).
23022303
The latter may be specified
23032304
either as a list of optional positional parameters,
23042305
or as a set of named parameters,
@@ -2502,8 +2503,14 @@ \subsubsection{Required Formals}
25022503
an instance method, instance setter, or instance operator.
25032504

25042505

2505-
\subsubsection{Optional and Named Formals}
2506-
\LMLabel{optionalFormals}
2506+
\subsubsection{Optional Formals and Named Formals}
2507+
\LMLabel{optionalFormalsAndNamedFormals}
2508+
2509+
\LMHash{}%
2510+
This section is concerned with optional parameters,
2511+
positional or named,
2512+
and with required named parameters.
2513+
They are handled together because they share grammar rules.
25072514

25082515
\LMHash{}%
25092516
Optional formal parameters may be specified and provided with default values.
@@ -2515,7 +2522,7 @@ \subsubsection{Optional and Named Formals}
25152522

25162523
<defaultNamedParameter> ::= \gnewline{}
25172524
<metadata> \REQUIRED? <normalFormalParameterNoMetadata>
2518-
\gnewline{} (`:' <expression>)?
2525+
\gnewline{} (`=' <expression>)?
25192526
\end{grammar}
25202527

25212528
\LMHash{}%
@@ -2533,7 +2540,7 @@ \subsubsection{Optional and Named Formals}
25332540
\Error{compile-time error} if a required named parameter has a default value.
25342541

25352542
\LMHash{}%
2536-
Assume that $p$ is an optional named parameter with default value $d$.
2543+
Assume that $p$ is an optional parameter with default value $d$.
25372544
It is a \Error{compile-time error}
25382545
if the static type of $d$ is not assignable to the declared type of $p$.
25392546

0 commit comments

Comments
 (0)