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 19, 2023
1 parent 9bebf93 commit df42dfe
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 @@ -2225,7 +2225,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 @@ -2429,8 +2430,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 @@ -2442,7 +2449,7 @@ \subsubsection{Optional and Named Formals}

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

\LMHash{}%
Expand All @@ -2460,7 +2467,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 df42dfe

Please sign in to comment.