Skip to content

Commit

Permalink
Add a paragraph explaining that the given section is about both optio…
Browse files Browse the repository at this point in the history
…nal and named parameters, not just parameters that are both
  • Loading branch information
eernstg committed Jul 18, 2023
1 parent 5beba67 commit 8f6a5e0
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions specification/dartLangSpec.tex
Original file line number Diff line number Diff line change
Expand Up @@ -2071,7 +2071,8 @@ \subsection{Formal Parameters}
\Index{formal parameter list},
which consists of a list of required positional parameters
(\ref{requiredFormals}),
followed by any optional and/or named parameters (\ref{optionalFormals}).
followed by any optional and/or named parameters
(\ref{optionalFormalsAndNamedFormals}).
The latter may be specified
either as a list of optional positional parameters,
or as a set of named parameters,
Expand Down Expand Up @@ -2275,8 +2276,14 @@ \subsubsection{Required Formals}
an instance method, instance setter, or instance operator.


\subsubsection{Optional and Named Formals}
\LMLabel{optionalFormals}
\subsubsection{Optional Formals and Named Formals}
\LMLabel{optionalFormalsAndNamedFormals}

\LMHash{}%
This section is concerned with optional parameters,
positional or named,
and with required named parameters.
They are handled together because they share grammar rules.

\LMHash{}%
Optional formal parameters may be specified and provided with default values.
Expand All @@ -2288,7 +2295,7 @@ \subsubsection{Optional and Named Formals}

<defaultNamedParameter> ::= \gnewline{}
<metadata> \REQUIRED? <normalFormalParameterNoMetadata>
\gnewline{} (`:' <expression>)?
\gnewline{} (`=' <expression>)?
\end{grammar}

\LMHash{}%
Expand All @@ -2306,7 +2313,7 @@ \subsubsection{Optional and Named Formals}
\Error{compile-time error} if a required named parameter has a default value.

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

Expand Down

0 comments on commit 8f6a5e0

Please sign in to comment.