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}\\
6061% - Clarify how line breaks are handled in a multi-line string literal. Rename
6162% the lexical token NEWLINE to LINE\_BREAK (clarifying that it is not `\n`).
6263%
63- % Feb 2023
64+ % Jan, Feb 2023
6465% - Change the specification of constant expressions of the form `e1 == e2`
6566% to use primitive equality.
67+ % - Introduce `\DynamicError{}`, thus marking every introduction (definition)
68+ % of a dynamic error by a lightning symbol in the right margin.
6669%
6770% Dec 2022
6871% - Change the definition of the type function 'flatten' to resolve soundness
@@ -1575,7 +1578,7 @@ \subsection{Implicitly Induced Getters and Setters}
15751578will bind \id{} to the object that the argument $x$ is bound to.
15761579An execution of the setter
15771580in a situation where the variable \id{} has been bound to an object
1578- will incur a dynamic error.
1581+ will incur a \DynamicError{ dynamic error} .
15791582\EndCase
15801583
15811584\LMHash{}%
@@ -4158,7 +4161,7 @@ \subsubsection{Generative Constructors}
41584161% This can occur due to a failing implicit cast.
41594162unless the assigned object has a dynamic type
41604163which is not a subtype of the declared type of the instance variable \id,
4161- in which case a dynamic error occurs.
4164+ in which case a \DynamicError{ dynamic error} occurs.
41624165
41634166\commentary{%
41644167The above rule allows initializing formals to be used as optional parameters:%
@@ -10451,7 +10454,7 @@ \subsubsection{Collection Literal Element Evaluation}
1045110454 or the given \code{value} does not have the type \code{Value},
1045210455 but it cannot occur after the pair has been appended to $s$.
1045310456 \item
10454- Otherwise, a dynamic error occurs.
10457+ Otherwise, a \DynamicError{ dynamic error} occurs.
1045510458
1045610459 \commentary{%
1045710460 This occurs when the target is an iterable respectively a map,
@@ -10506,7 +10509,8 @@ \subsubsection{Collection Literal Element Evaluation}
1050610509and if $\ell_2$ is not present then
1050710510$\EvaluateElement{\ell} := \LiteralSequence{}$.
1050810511% $o_b$ can have type \DYNAMIC.
10509- If $o_b$ is neither \TRUE{} nor \FALSE{} then a dynamic error occurs.
10512+ If $o_b$ is neither \TRUE{} nor \FALSE{}
10513+ then a \DynamicError{dynamic error} occurs.
1051010514\EndCase
1051110515
1051210516\LMHash{}%
@@ -10737,7 +10741,7 @@ \subsubsection{Lists}
1073710741An empty list has an empty set of indices.
1073810742A non-empty list has the index set $\{0, \ldots, n - 1\}$
1073910743where $n$ is the size of the list.
10740- It is a dynamic error to attempt to access a list
10744+ It is a \DynamicError{ dynamic error} to attempt to access a list
1074110745using an index that is not a member of its set of indices.
1074210746
1074310747\rationale{%
@@ -10761,7 +10765,8 @@ \subsubsection{Lists}
1076110765Only run-time list literals can be mutated
1076210766after they are created.
1076310767% This error can occur because being constant is a dynamic property.
10764- Attempting to mutate a constant list literal will result in a dynamic error.
10768+ Attempting to mutate a constant list literal
10769+ will result in a \DynamicError{dynamic error}.
1076510770
1076610771\commentary{%
1076710772% The following is true either directly or indirectly: There is a \CONST{}
@@ -11530,7 +11535,7 @@ \subsubsection{Sets}
1153011535\LMHash{}%
1153111536A set may contain zero or more objects.
1153211537Sets have a method which can be used to insert objects;
11533- this will incur a dynamic error if the set is not modifiable.
11538+ this will incur a \DynamicError{ dynamic error} if the set is not modifiable.
1153411539Otherwise, when inserting an object $o_{\metavar{new}}$ into a set $s$,
1153511540if an object $o_{\metavar{old}}$ exists in $s$ such that
1153611541\code{$o_{\metavar{old}}$ == $o_{\metavar{new}}$} evaluates to \TRUE{}
@@ -11570,7 +11575,8 @@ \subsubsection{Sets}
1157011575and it is evaluated at run time.
1157111576Only run-time set literals can be mutated after they are created.
1157211577% This error can occur because being constant is a dynamic property, here.
11573- Attempting to mutate a constant set literal will result in a dynamic error.
11578+ Attempting to mutate a constant set literal
11579+ will result in a \DynamicError{dynamic error}.
1157411580
1157511581\commentary{%
1157611582% The following is true either directly or indirectly: There is a \CONST{}
@@ -11776,7 +11782,8 @@ \subsubsection{Maps}
1177611782and it is evaluated at run time.
1177711783Only run-time map literals can be mutated after they are created.
1177811784% This error can occur because being constant is a dynamic property, here.
11779- Attempting to mutate a constant map literal will result in a dynamic error.
11785+ Attempting to mutate a constant map literal
11786+ will result in a \DynamicError{dynamic error}.
1178011787
1178111788\commentary{%
1178211789% The following is true either directly or indirectly: There is a \CONST{}
@@ -11917,7 +11924,8 @@ \subsection{Throw}
1191711924}
1191811925
1191911926\LMHash{}%
11920- If $v$ is the null object (\ref{null}), then a dynamic error occurs.
11927+ If $v$ is the null object (\ref{null})
11928+ then a \DynamicError{dynamic error} occurs.
1192111929Otherwise let $t$ be a stack trace corresponding to the current execution state,
1192211930and the \THROW{} statement throws with $v$ as exception object
1192311931and $t$ as stack trace (\ref{expressionEvaluation}).
@@ -12437,7 +12445,7 @@ \subsubsection{New}
1243712445% This error can occur because being-loaded is a dynamic property.
1243812446If $T$ is a deferred type with prefix $p$,
1243912447then if $p$ has not been successfully loaded,
12440- a dynamic error occurs.
12448+ a \DynamicError{ dynamic error} occurs.
1244112449\EndCase
1244212450
1244312451\LMHash{}%
@@ -13365,7 +13373,7 @@ \subsubsection{Binding Actuals to Formals}
1336513373If $r = 0$ and $s > 0$ then
1336613374if $f$ does not have default type arguments
1336713375(\ref{instantiationToBound})
13368- then a dynamic error occurs.
13376+ then a \DynamicError{ dynamic error} occurs.
1336913377Otherwise replace the actual type argument list:
1337013378Let $r$ be $s$ and let $t_i$ for $i \in 1 .. s$ be the result of
1337113379instantiation to bound
@@ -16388,7 +16396,8 @@ \subsection{Assignment}
1638816396 in which case $v$ has no initializer and is not definitely assigned,
1638916397 or a compile-time error would have occurred%
1639016398 }).
16391- If $v$ has previously been bound to an object then a dynamic error occurs.
16399+ If $v$ has previously been bound to an object
16400+ then a \DynamicError{dynamic error} occurs.
1639216401 Otherwise, $v$ is bound to $o$, and then $a$ evaluates to $o$
1639316402 (\ref{expressionEvaluation}).
1639416403 \item
@@ -16940,7 +16949,8 @@ \subsection{Conditional}
1694016949proceeds as follows:
1694116950Evaluate $e_1$ to an object $o_1$.
1694216951% This error can occur due to an implicit cast from \DYNAMIC.
16943- It is a dynamic error if the run-time type of $o_1$ is not \code{bool}.
16952+ It is a \DynamicError{dynamic error}
16953+ if the run-time type of $o_1$ is not \code{bool}.
1694416954If $o_1$ is the \TRUE{} object, then the value of $c$ is
1694516955the result of evaluating the expression $e_2$.
1694616956Otherwise, the value of $c$ is the result of evaluating the expression $e_3$.
@@ -17008,23 +17018,27 @@ \subsection{Logical Boolean Expressions}
1700817018\code{$e_1$\,\,||\,\,$e_2$}
1700917019causes the evaluation of $e_1$ to an object $o_1$.
1701017020% This error can occur due to an implicit downcast from \DYNAMIC.
17011- It is a dynamic error if the run-time type of $o_1$ is not \code{bool}.
17021+ It is a \DynamicError{dynamic error}
17022+ if the run-time type of $o_1$ is not \code{bool}.
1701217023If $o_1$ is \TRUE, the result of evaluating $b$ is \TRUE,
1701317024otherwise $e_2$ is evaluated to an object $o_2$.
1701417025% This error can occur due to an implicit downcast from \DYNAMIC.
17015- It is a dynamic error if the run-time type of $o_2$ is not \code{bool}.
17026+ It is a \DynamicError{dynamic error}
17027+ if the run-time type of $o_2$ is not \code{bool}.
1701617028Otherwise the result of evaluating $b$ is $o_2$.
1701717029
1701817030\LMHash{}%
1701917031Evaluation of a logical boolean expression $b$ of the form
1702017032\code{$e_1$\,\,\&\&\,\,$e_2$}
1702117033causes the evaluation of $e_1$ to an object $o_1$.
1702217034% This error can occur due to an implicit downcast from \DYNAMIC.
17023- It is a dynamic error if the run-time type of $o_1$ is not \code{bool}.
17035+ It is a \DynamicError{dynamic error}
17036+ if the run-time type of $o_1$ is not \code{bool}.
1702417037If $o_1$ is \FALSE, the result of evaluating $b$ is \FALSE,
1702517038otherwise $e_2$ is evaluated to an object $o_2$.
1702617039% This error can occur due to an implicit downcast from \DYNAMIC.
17027- It is a dynamic error if the run-time type of $o_2$ is not \code{bool}.
17040+ It is a \DynamicError{dynamic error}
17041+ if the run-time type of $o_2$ is not \code{bool}.
1702817042Otherwise the result of evaluating $b$ is $o_2$.
1702917043
1703017044
@@ -17609,7 +17623,7 @@ \subsection{Postfix Expressions}
1760917623
1761017624\LMHash{}%
1761117625$e$ is evaluated as follows: $e_1$ is evaluated to an object $o$.
17612- If $o$ is the null object then a dynamic error occurs,
17626+ If $o$ is the null object then a \DynamicError{ dynamic error} occurs,
1761317627otherwise $e$ evaluates to $o$.
1761417628\EndCase
1761517629
@@ -18937,7 +18951,7 @@ \subsection{Local Variable Declaration}
1893718951then $v$ is bound to $o$.
1893818952If an object $o$ is assigned to $v$
1893918953in a situation where $v$ is bound to an object $o'$
18940- then a dynamic error occurs
18954+ then a \DynamicError{ dynamic error} occurs
1894118955(\commentary{it does not matter whether $o$ is the same object as $o'$}).
1894218956
1894318957\commentary{%
@@ -19098,7 +19112,8 @@ \subsection{If}
1909819112proceeds as follows:
1909919113Evaluate the expression $e$ to an object $o$.
1910019114% This error can occur due to an implicit downcast from \DYNAMIC.
19101- It is a dynamic error if the run-time type of $o$ is not \code{bool}.
19115+ It is a \DynamicError{dynamic error}
19116+ if the run-time type of $o$ is not \code{bool}.
1910219117If $o$ is \TRUE, then execute the block statement $S_1$,
1910319118otherwise execute the block statement $S_2$.
1910419119
@@ -19181,7 +19196,8 @@ \subsubsection{For Loop}
1918119196\item
1918219197 The expression $[v'/v]c$ is evaluated to an object $o$.
1918319198 % This error can occur due to an implicit downcast from \DYNAMIC.
19184- It is a dynamic error if the run-time type of $o$ is not \code{bool}.
19199+ It is a \DynamicError{dynamic error}
19200+ if the run-time type of $o$ is not \code{bool}.
1918519201 If $o$ is \FALSE, the for loop completes normally.
1918619202 Otherwise, execution continues at step \ref{beginIteration}.
1918719203\item
@@ -19394,7 +19410,8 @@ \subsection{While}
1939419410\LMHash{}%
1939519411The expression $e$ is evaluated to an object $o$.
1939619412% This error can occur due to an implicit downcast from \DYNAMIC.
19397- It is a dynamic error if the run-time type of $o$ is not \code{bool}.
19413+ It is a \DynamicError{dynamic error}
19414+ if the run-time type of $o$ is not \code{bool}.
1939819415
1939919416\LMHash{}%
1940019417If $o$ is \FALSE, then execution of the while statement completes normally
@@ -19445,7 +19462,8 @@ \subsection{Do}
1944519462\LMHash{}%
1944619463Then, the expression $e$ is evaluated to an object $o$.
1944719464% This error can occur due to an implicit downcast from \DYNAMIC.
19448- It is a dynamic error if the run-time type of $o$ is not \code{bool}.
19465+ It is a \DynamicError{dynamic error}
19466+ if the run-time type of $o$ is not \code{bool}.
1944919467If $o$ is \FALSE, execution of the do statement completes normally
1945019468(\ref{statementCompletion}).
1945119469If $o$ is \TRUE, then the do statement is re-executed.
@@ -20136,7 +20154,8 @@ \subsection{Return}
2013620154
2013720155\LMHash{}%
2013820156The expression $e$ is evaluated to an object $o$.
20139- A dynamic error occurs unless the dynamic type of $o$ is a subtype of
20157+ A \DynamicError{dynamic error} occurs
20158+ unless the dynamic type of $o$ is a subtype of
2014020159the actual return type of $f$
2014120160(\ref{actualTypes}).
2014220161Then the return statement $s$ completes returning $o$
@@ -20163,7 +20182,8 @@ \subsection{Return}
2016320182let \code{v} be a fresh variable bound to $o$ and
2016420183evaluate \code{\AWAIT{} v} to an object $r$;
2016520184otherwise let $r$ be $o$.
20166- A dynamic error occurs unless the dynamic type of $r$
20185+ A \DynamicError{dynamic error} occurs
20186+ unless the dynamic type of $r$
2016720187is a subtype of the actual value of $T_v$
2016820188(\ref{actualTypes}).
2016920189Then the return statement $s$ completes returning $r$
@@ -21048,28 +21068,28 @@ \subsubsection{Semantics of Imports}
2104821068 \NamespaceName{\metavar{import},i},
2104921069 a corresponding function named \id{} with the same function header as $f$.
2105021070 % This error can occur because being-loaded is a dynamic property.
21051- Calling the function results in a dynamic error,
21071+ Calling the function results in a \DynamicError{ dynamic error} ,
2105221072 and so does closurizing it
2105321073 (\ref{functionClosurization}).
2105421074\item
2105521075 For every top level getter $g$ named \id{} in
2105621076 \NamespaceName{\metavar{import},i},
2105721077 a corresponding getter named \id{} with the same function header as $g$.
2105821078 % This error can occur because being-loaded is a dynamic property.
21059- Calling the getter results in a dynamic error.
21079+ Calling the getter results in a \DynamicError{ dynamic error} .
2106021080\item
2106121081 For every top level setter $s$ named \code{\id=} in
2106221082 \NamespaceName{\metavar{import},i},
2106321083 a corresponding setter named \code{\id=} with
2106421084 the same function header as $s$.
2106521085 % This error can occur because being-loaded is a dynamic property.
21066- Calling the setter results in a dynamic error.
21086+ Calling the setter results in a \DynamicError{ dynamic error} .
2106721087\item
2106821088 For every class, mixin, enum, and type alias declaration named \id{} in
2106921089 \NamespaceName{\metavar{import},i},
2107021090 a corresponding getter named \id{} with return type \code{Type}.
2107121091 % This error can occur because being-loaded is a dynamic property.
21072- Calling the getter results in a dynamic error.
21092+ Calling the getter results in a \DynamicError{ dynamic error} .
2107321093\end{itemize}
2107421094
2107521095\rationale{%
@@ -21603,7 +21623,7 @@ \subsection{Scripts}
2160321623 that spawned $i$%
2160421624 }),
2160521625 or the null object if no such object was supplied.
21606- A dynamic error occurs if
21626+ A \DynamicError{ dynamic error} occurs if
2160721627 the run-time type of this object is not a subtype of
2160821628 the declared type of the corresponding parameter of \code{main}.
2160921629\end{itemize}
@@ -21626,7 +21646,7 @@ \subsection{Scripts}
2162621646(\commentary{%
2162721647the above rules ensure that the corresponding parameters are optional%
2162821648}).
21629- But the implementation must ensure that a dynamic error occurs
21649+ But the implementation must ensure that a \DynamicError{ dynamic error} occurs
2163021650if an actual argument does not have a run-time type which is
2163121651a subtype of the declared type of the parameter.
2163221652
0 commit comments