1212\usepackage[T1]{fontenc}
1313\usepackage{makeidx}
1414\usepackage{enumitem}
15+ \usepackage{marvosym}
1516\makeindex
1617\title{Dart Programming Language Specification\\
1718{6th edition draft}\\
7071% error anyway; change extension names to `typeIdentifier`, avoiding
7172% built-in identifiers).
7273%
73- % Feb 2023
74+ % Jan, Feb 2023
7475% - Change the specification of constant expressions of the form `e1 == e2`
7576% to use primitive equality.
77+ % - Introduce `\DynamicError{}`, thus marking every introduction (definition)
78+ % of a dynamic error by a lightning symbol in the right margin.
7679%
7780% Dec 2022
7881% - Change the definition of the type function 'flatten' to resolve soundness
@@ -1585,7 +1588,7 @@ \subsection{Implicitly Induced Getters and Setters}
15851588will bind \id{} to the object that the argument $x$ is bound to.
15861589An execution of the setter
15871590in a situation where the variable \id{} has been bound to an object
1588- will incur a dynamic error.
1591+ will incur a \DynamicError{ dynamic error} .
15891592\EndCase
15901593
15911594\LMHash{}%
@@ -4178,7 +4181,7 @@ \subsubsection{Generative Constructors}
41784181% This can occur due to a failing implicit cast.
41794182unless the assigned object has a dynamic type
41804183which is not a subtype of the declared type of the instance variable \id,
4181- in which case a dynamic error occurs.
4184+ in which case a \DynamicError{ dynamic error} occurs.
41824185
41834186\commentary{%
41844187The above rule allows initializing formals to be used as optional parameters:%
@@ -10469,7 +10472,7 @@ \subsubsection{Collection Literal Element Evaluation}
1046910472 or the given \code{value} does not have the type \code{Value},
1047010473 but it cannot occur after the pair has been appended to $s$.
1047110474 \item
10472- Otherwise, a dynamic error occurs.
10475+ Otherwise, a \DynamicError{ dynamic error} occurs.
1047310476
1047410477 \commentary{%
1047510478 This occurs when the target is an iterable respectively a map,
@@ -10524,7 +10527,8 @@ \subsubsection{Collection Literal Element Evaluation}
1052410527and if $\ell_2$ is not present then
1052510528$\EvaluateElement{\ell} := \LiteralSequence{}$.
1052610529% $o_b$ can have type \DYNAMIC.
10527- If $o_b$ is neither \TRUE{} nor \FALSE{} then a dynamic error occurs.
10530+ If $o_b$ is neither \TRUE{} nor \FALSE{}
10531+ then a \DynamicError{dynamic error} occurs.
1052810532\EndCase
1052910533
1053010534\LMHash{}%
@@ -10755,7 +10759,7 @@ \subsubsection{Lists}
1075510759An empty list has an empty set of indices.
1075610760A non-empty list has the index set $\{0, \ldots, n - 1\}$
1075710761where $n$ is the size of the list.
10758- It is a dynamic error to attempt to access a list
10762+ It is a \DynamicError{ dynamic error} to attempt to access a list
1075910763using an index that is not a member of its set of indices.
1076010764
1076110765\rationale{%
@@ -10779,7 +10783,8 @@ \subsubsection{Lists}
1077910783Only run-time list literals can be mutated
1078010784after they are created.
1078110785% This error can occur because being constant is a dynamic property.
10782- Attempting to mutate a constant list literal will result in a dynamic error.
10786+ Attempting to mutate a constant list literal
10787+ will result in a \DynamicError{dynamic error}.
1078310788
1078410789\commentary{%
1078510790% The following is true either directly or indirectly: There is a \CONST{}
@@ -11548,7 +11553,7 @@ \subsubsection{Sets}
1154811553\LMHash{}%
1154911554A set may contain zero or more objects.
1155011555Sets have a method which can be used to insert objects;
11551- this will incur a dynamic error if the set is not modifiable.
11556+ this will incur a \DynamicError{ dynamic error} if the set is not modifiable.
1155211557Otherwise, when inserting an object $o_{\metavar{new}}$ into a set $s$,
1155311558if an object $o_{\metavar{old}}$ exists in $s$ such that
1155411559\code{$o_{\metavar{old}}$ == $o_{\metavar{new}}$} evaluates to \TRUE{}
@@ -11588,7 +11593,8 @@ \subsubsection{Sets}
1158811593and it is evaluated at run time.
1158911594Only run-time set literals can be mutated after they are created.
1159011595% This error can occur because being constant is a dynamic property, here.
11591- Attempting to mutate a constant set literal will result in a dynamic error.
11596+ Attempting to mutate a constant set literal
11597+ will result in a \DynamicError{dynamic error}.
1159211598
1159311599\commentary{%
1159411600% The following is true either directly or indirectly: There is a \CONST{}
@@ -11794,7 +11800,8 @@ \subsubsection{Maps}
1179411800and it is evaluated at run time.
1179511801Only run-time map literals can be mutated after they are created.
1179611802% This error can occur because being constant is a dynamic property, here.
11797- Attempting to mutate a constant map literal will result in a dynamic error.
11803+ Attempting to mutate a constant map literal
11804+ will result in a \DynamicError{dynamic error}.
1179811805
1179911806\commentary{%
1180011807% The following is true either directly or indirectly: There is a \CONST{}
@@ -11935,7 +11942,8 @@ \subsection{Throw}
1193511942}
1193611943
1193711944\LMHash{}%
11938- If $v$ is the null object (\ref{null}), then a dynamic error occurs.
11945+ If $v$ is the null object (\ref{null})
11946+ then a \DynamicError{dynamic error} occurs.
1193911947Otherwise let $t$ be a stack trace corresponding to the current execution state,
1194011948and the \THROW{} statement throws with $v$ as exception object
1194111949and $t$ as stack trace (\ref{expressionEvaluation}).
@@ -12455,7 +12463,7 @@ \subsubsection{New}
1245512463% This error can occur because being-loaded is a dynamic property.
1245612464If $T$ is a deferred type with prefix $p$,
1245712465then if $p$ has not been successfully loaded,
12458- a dynamic error occurs.
12466+ a \DynamicError{ dynamic error} occurs.
1245912467\EndCase
1246012468
1246112469\LMHash{}%
@@ -13384,7 +13392,7 @@ \subsubsection{Binding Actuals to Formals}
1338413392If $r = 0$ and $s > 0$ then
1338513393if $f$ does not have default type arguments
1338613394(\ref{instantiationToBound})
13387- then a dynamic error occurs.
13395+ then a \DynamicError{ dynamic error} occurs.
1338813396Otherwise replace the actual type argument list:
1338913397Let $r$ be $s$ and let $t_i$ for $i \in 1 .. s$ be the result of
1339013398instantiation to bound
@@ -16407,7 +16415,8 @@ \subsection{Assignment}
1640716415 in which case $v$ has no initializer and is not definitely assigned,
1640816416 or a compile-time error would have occurred%
1640916417 }).
16410- If $v$ has previously been bound to an object then a dynamic error occurs.
16418+ If $v$ has previously been bound to an object
16419+ then a \DynamicError{dynamic error} occurs.
1641116420 Otherwise, $v$ is bound to $o$, and then $a$ evaluates to $o$
1641216421 (\ref{expressionEvaluation}).
1641316422 \item
@@ -16959,7 +16968,8 @@ \subsection{Conditional}
1695916968proceeds as follows:
1696016969Evaluate $e_1$ to an object $o_1$.
1696116970% This error can occur due to an implicit cast from \DYNAMIC.
16962- It is a dynamic error if the run-time type of $o_1$ is not \code{bool}.
16971+ It is a \DynamicError{dynamic error}
16972+ if the run-time type of $o_1$ is not \code{bool}.
1696316973If $o_1$ is the \TRUE{} object, then the value of $c$ is
1696416974the result of evaluating the expression $e_2$.
1696516975Otherwise, the value of $c$ is the result of evaluating the expression $e_3$.
@@ -17027,23 +17037,27 @@ \subsection{Logical Boolean Expressions}
1702717037\code{$e_1$\,\,||\,\,$e_2$}
1702817038causes the evaluation of $e_1$ to an object $o_1$.
1702917039% This error can occur due to an implicit downcast from \DYNAMIC.
17030- It is a dynamic error if the run-time type of $o_1$ is not \code{bool}.
17040+ It is a \DynamicError{dynamic error}
17041+ if the run-time type of $o_1$ is not \code{bool}.
1703117042If $o_1$ is \TRUE, the result of evaluating $b$ is \TRUE,
1703217043otherwise $e_2$ is evaluated to an object $o_2$.
1703317044% This error can occur due to an implicit downcast from \DYNAMIC.
17034- It is a dynamic error if the run-time type of $o_2$ is not \code{bool}.
17045+ It is a \DynamicError{dynamic error}
17046+ if the run-time type of $o_2$ is not \code{bool}.
1703517047Otherwise the result of evaluating $b$ is $o_2$.
1703617048
1703717049\LMHash{}%
1703817050Evaluation of a logical boolean expression $b$ of the form
1703917051\code{$e_1$\,\,\&\&\,\,$e_2$}
1704017052causes the evaluation of $e_1$ to an object $o_1$.
1704117053% This error can occur due to an implicit downcast from \DYNAMIC.
17042- It is a dynamic error if the run-time type of $o_1$ is not \code{bool}.
17054+ It is a \DynamicError{dynamic error}
17055+ if the run-time type of $o_1$ is not \code{bool}.
1704317056If $o_1$ is \FALSE, the result of evaluating $b$ is \FALSE,
1704417057otherwise $e_2$ is evaluated to an object $o_2$.
1704517058% This error can occur due to an implicit downcast from \DYNAMIC.
17046- It is a dynamic error if the run-time type of $o_2$ is not \code{bool}.
17059+ It is a \DynamicError{dynamic error}
17060+ if the run-time type of $o_2$ is not \code{bool}.
1704717061Otherwise the result of evaluating $b$ is $o_2$.
1704817062
1704917063
@@ -17628,7 +17642,7 @@ \subsection{Postfix Expressions}
1762817642
1762917643\LMHash{}%
1763017644$e$ is evaluated as follows: $e_1$ is evaluated to an object $o$.
17631- If $o$ is the null object then a dynamic error occurs,
17645+ If $o$ is the null object then a \DynamicError{ dynamic error} occurs,
1763217646otherwise $e$ evaluates to $o$.
1763317647\EndCase
1763417648
@@ -18960,7 +18974,7 @@ \subsection{Local Variable Declaration}
1896018974then $v$ is bound to $o$.
1896118975If an object $o$ is assigned to $v$
1896218976in a situation where $v$ is bound to an object $o'$
18963- then a dynamic error occurs
18977+ then a \DynamicError{ dynamic error} occurs
1896418978(\commentary{it does not matter whether $o$ is the same object as $o'$}).
1896518979
1896618980\commentary{%
@@ -19121,7 +19135,8 @@ \subsection{If}
1912119135proceeds as follows:
1912219136Evaluate the expression $e$ to an object $o$.
1912319137% This error can occur due to an implicit downcast from \DYNAMIC.
19124- It is a dynamic error if the run-time type of $o$ is not \code{bool}.
19138+ It is a \DynamicError{dynamic error}
19139+ if the run-time type of $o$ is not \code{bool}.
1912519140If $o$ is \TRUE, then execute the block statement $S_1$,
1912619141otherwise execute the block statement $S_2$.
1912719142
@@ -19204,7 +19219,8 @@ \subsubsection{For Loop}
1920419219\item
1920519220 The expression $[v'/v]c$ is evaluated to an object $o$.
1920619221 % This error can occur due to an implicit downcast from \DYNAMIC.
19207- It is a dynamic error if the run-time type of $o$ is not \code{bool}.
19222+ It is a \DynamicError{dynamic error}
19223+ if the run-time type of $o$ is not \code{bool}.
1920819224 If $o$ is \FALSE, the for loop completes normally.
1920919225 Otherwise, execution continues at step \ref{beginIteration}.
1921019226\item
@@ -19417,7 +19433,8 @@ \subsection{While}
1941719433\LMHash{}%
1941819434The expression $e$ is evaluated to an object $o$.
1941919435% This error can occur due to an implicit downcast from \DYNAMIC.
19420- It is a dynamic error if the run-time type of $o$ is not \code{bool}.
19436+ It is a \DynamicError{dynamic error}
19437+ if the run-time type of $o$ is not \code{bool}.
1942119438
1942219439\LMHash{}%
1942319440If $o$ is \FALSE, then execution of the while statement completes normally
@@ -19468,7 +19485,8 @@ \subsection{Do}
1946819485\LMHash{}%
1946919486Then, the expression $e$ is evaluated to an object $o$.
1947019487% This error can occur due to an implicit downcast from \DYNAMIC.
19471- It is a dynamic error if the run-time type of $o$ is not \code{bool}.
19488+ It is a \DynamicError{dynamic error}
19489+ if the run-time type of $o$ is not \code{bool}.
1947219490If $o$ is \FALSE, execution of the do statement completes normally
1947319491(\ref{statementCompletion}).
1947419492If $o$ is \TRUE, then the do statement is re-executed.
@@ -20159,7 +20177,8 @@ \subsection{Return}
2015920177
2016020178\LMHash{}%
2016120179The expression $e$ is evaluated to an object $o$.
20162- A dynamic error occurs unless the dynamic type of $o$ is a subtype of
20180+ A \DynamicError{dynamic error} occurs
20181+ unless the dynamic type of $o$ is a subtype of
2016320182the actual return type of $f$
2016420183(\ref{actualTypes}).
2016520184Then the return statement $s$ completes returning $o$
@@ -20186,7 +20205,8 @@ \subsection{Return}
2018620205let \code{v} be a fresh variable bound to $o$ and
2018720206evaluate \code{\AWAIT{} v} to an object $r$;
2018820207otherwise let $r$ be $o$.
20189- A dynamic error occurs unless the dynamic type of $r$
20208+ A \DynamicError{dynamic error} occurs
20209+ unless the dynamic type of $r$
2019020210is a subtype of the actual value of $T_v$
2019120211(\ref{actualTypes}).
2019220212Then the return statement $s$ completes returning $r$
@@ -21073,28 +21093,28 @@ \subsubsection{Semantics of Imports}
2107321093 \NamespaceName{\metavar{import},i},
2107421094 a corresponding function named \id{} with the same function header as $f$.
2107521095 % This error can occur because being-loaded is a dynamic property.
21076- Calling the function results in a dynamic error,
21096+ Calling the function results in a \DynamicError{ dynamic error} ,
2107721097 and so does closurizing it
2107821098 (\ref{functionClosurization}).
2107921099\item
2108021100 For every top level getter $g$ named \id{} in
2108121101 \NamespaceName{\metavar{import},i},
2108221102 a corresponding getter named \id{} with the same function header as $g$.
2108321103 % This error can occur because being-loaded is a dynamic property.
21084- Calling the getter results in a dynamic error.
21104+ Calling the getter results in a \DynamicError{ dynamic error} .
2108521105\item
2108621106 For every top level setter $s$ named \code{\id=} in
2108721107 \NamespaceName{\metavar{import},i},
2108821108 a corresponding setter named \code{\id=} with
2108921109 the same function header as $s$.
2109021110 % This error can occur because being-loaded is a dynamic property.
21091- Calling the setter results in a dynamic error.
21111+ Calling the setter results in a \DynamicError{ dynamic error} .
2109221112\item
2109321113 For every class, mixin, enum, and type alias declaration named \id{} in
2109421114 \NamespaceName{\metavar{import},i},
2109521115 a corresponding getter named \id{} with return type \code{Type}.
2109621116 % This error can occur because being-loaded is a dynamic property.
21097- Calling the getter results in a dynamic error.
21117+ Calling the getter results in a \DynamicError{ dynamic error} .
2109821118\end{itemize}
2109921119
2110021120\rationale{%
@@ -21628,7 +21648,7 @@ \subsection{Scripts}
2162821648 that spawned $i$%
2162921649 }),
2163021650 or the null object if no such object was supplied.
21631- A dynamic error occurs if
21651+ A \DynamicError{ dynamic error} occurs if
2163221652 the run-time type of this object is not a subtype of
2163321653 the declared type of the corresponding parameter of \code{main}.
2163421654\end{itemize}
@@ -21651,7 +21671,7 @@ \subsection{Scripts}
2165121671(\commentary{%
2165221672the above rules ensure that the corresponding parameters are optional%
2165321673}).
21654- But the implementation must ensure that a dynamic error occurs
21674+ But the implementation must ensure that a \DynamicError{ dynamic error} occurs
2165521675if an actual argument does not have a run-time type which is
2165621676a subtype of the declared type of the parameter.
2165721677
0 commit comments