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}\\
6566% error anyway; change extension names to `typeIdentifier`, avoiding
6667% built-in identifiers).
6768%
68- % Feb 2023
69+ % Jan, Feb 2023
6970% - Change the specification of constant expressions of the form `e1 == e2`
7071% to use primitive equality.
72+ % - Introduce `\DynamicError{}`, thus marking every introduction (definition)
73+ % of a dynamic error by a lightning symbol in the right margin.
7174%
7275% Dec 2022
7376% - Change the definition of the type function 'flatten' to resolve soundness
@@ -1580,7 +1583,7 @@ \subsection{Implicitly Induced Getters and Setters}
15801583will bind \id{} to the object that the argument $x$ is bound to.
15811584An execution of the setter
15821585in a situation where the variable \id{} has been bound to an object
1583- will incur a dynamic error.
1586+ will incur a \DynamicError{ dynamic error} .
15841587\EndCase
15851588
15861589\LMHash{}%
@@ -4173,7 +4176,7 @@ \subsubsection{Generative Constructors}
41734176% This can occur due to a failing implicit cast.
41744177unless the assigned object has a dynamic type
41754178which is not a subtype of the declared type of the instance variable \id,
4176- in which case a dynamic error occurs.
4179+ in which case a \DynamicError{ dynamic error} occurs.
41774180
41784181\commentary{%
41794182The above rule allows initializing formals to be used as optional parameters:%
@@ -10464,7 +10467,7 @@ \subsubsection{Collection Literal Element Evaluation}
1046410467 or the given \code{value} does not have the type \code{Value},
1046510468 but it cannot occur after the pair has been appended to $s$.
1046610469 \item
10467- Otherwise, a dynamic error occurs.
10470+ Otherwise, a \DynamicError{ dynamic error} occurs.
1046810471
1046910472 \commentary{%
1047010473 This occurs when the target is an iterable respectively a map,
@@ -10519,7 +10522,8 @@ \subsubsection{Collection Literal Element Evaluation}
1051910522and if $\ell_2$ is not present then
1052010523$\EvaluateElement{\ell} := \LiteralSequence{}$.
1052110524% $o_b$ can have type \DYNAMIC.
10522- If $o_b$ is neither \TRUE{} nor \FALSE{} then a dynamic error occurs.
10525+ If $o_b$ is neither \TRUE{} nor \FALSE{}
10526+ then a \DynamicError{dynamic error} occurs.
1052310527\EndCase
1052410528
1052510529\LMHash{}%
@@ -10750,7 +10754,7 @@ \subsubsection{Lists}
1075010754An empty list has an empty set of indices.
1075110755A non-empty list has the index set $\{0, \ldots, n - 1\}$
1075210756where $n$ is the size of the list.
10753- It is a dynamic error to attempt to access a list
10757+ It is a \DynamicError{ dynamic error} to attempt to access a list
1075410758using an index that is not a member of its set of indices.
1075510759
1075610760\rationale{%
@@ -10774,7 +10778,8 @@ \subsubsection{Lists}
1077410778Only run-time list literals can be mutated
1077510779after they are created.
1077610780% This error can occur because being constant is a dynamic property.
10777- Attempting to mutate a constant list literal will result in a dynamic error.
10781+ Attempting to mutate a constant list literal
10782+ will result in a \DynamicError{dynamic error}.
1077810783
1077910784\commentary{%
1078010785% The following is true either directly or indirectly: There is a \CONST{}
@@ -11543,7 +11548,7 @@ \subsubsection{Sets}
1154311548\LMHash{}%
1154411549A set may contain zero or more objects.
1154511550Sets have a method which can be used to insert objects;
11546- this will incur a dynamic error if the set is not modifiable.
11551+ this will incur a \DynamicError{ dynamic error} if the set is not modifiable.
1154711552Otherwise, when inserting an object $o_{\metavar{new}}$ into a set $s$,
1154811553if an object $o_{\metavar{old}}$ exists in $s$ such that
1154911554\code{$o_{\metavar{old}}$ == $o_{\metavar{new}}$} evaluates to \TRUE{}
@@ -11583,7 +11588,8 @@ \subsubsection{Sets}
1158311588and it is evaluated at run time.
1158411589Only run-time set literals can be mutated after they are created.
1158511590% This error can occur because being constant is a dynamic property, here.
11586- Attempting to mutate a constant set literal will result in a dynamic error.
11591+ Attempting to mutate a constant set literal
11592+ will result in a \DynamicError{dynamic error}.
1158711593
1158811594\commentary{%
1158911595% The following is true either directly or indirectly: There is a \CONST{}
@@ -11789,7 +11795,8 @@ \subsubsection{Maps}
1178911795and it is evaluated at run time.
1179011796Only run-time map literals can be mutated after they are created.
1179111797% This error can occur because being constant is a dynamic property, here.
11792- Attempting to mutate a constant map literal will result in a dynamic error.
11798+ Attempting to mutate a constant map literal
11799+ will result in a \DynamicError{dynamic error}.
1179311800
1179411801\commentary{%
1179511802% The following is true either directly or indirectly: There is a \CONST{}
@@ -11930,7 +11937,8 @@ \subsection{Throw}
1193011937}
1193111938
1193211939\LMHash{}%
11933- If $v$ is the null object (\ref{null}), then a dynamic error occurs.
11940+ If $v$ is the null object (\ref{null})
11941+ then a \DynamicError{dynamic error} occurs.
1193411942Otherwise let $t$ be a stack trace corresponding to the current execution state,
1193511943and the \THROW{} statement throws with $v$ as exception object
1193611944and $t$ as stack trace (\ref{expressionEvaluation}).
@@ -12450,7 +12458,7 @@ \subsubsection{New}
1245012458% This error can occur because being-loaded is a dynamic property.
1245112459If $T$ is a deferred type with prefix $p$,
1245212460then if $p$ has not been successfully loaded,
12453- a dynamic error occurs.
12461+ a \DynamicError{ dynamic error} occurs.
1245412462\EndCase
1245512463
1245612464\LMHash{}%
@@ -13379,7 +13387,7 @@ \subsubsection{Binding Actuals to Formals}
1337913387If $r = 0$ and $s > 0$ then
1338013388if $f$ does not have default type arguments
1338113389(\ref{instantiationToBound})
13382- then a dynamic error occurs.
13390+ then a \DynamicError{ dynamic error} occurs.
1338313391Otherwise replace the actual type argument list:
1338413392Let $r$ be $s$ and let $t_i$ for $i \in 1 .. s$ be the result of
1338513393instantiation to bound
@@ -16402,7 +16410,8 @@ \subsection{Assignment}
1640216410 in which case $v$ has no initializer and is not definitely assigned,
1640316411 or a compile-time error would have occurred%
1640416412 }).
16405- If $v$ has previously been bound to an object then a dynamic error occurs.
16413+ If $v$ has previously been bound to an object
16414+ then a \DynamicError{dynamic error} occurs.
1640616415 Otherwise, $v$ is bound to $o$, and then $a$ evaluates to $o$
1640716416 (\ref{expressionEvaluation}).
1640816417 \item
@@ -16954,7 +16963,8 @@ \subsection{Conditional}
1695416963proceeds as follows:
1695516964Evaluate $e_1$ to an object $o_1$.
1695616965% This error can occur due to an implicit cast from \DYNAMIC.
16957- It is a dynamic error if the run-time type of $o_1$ is not \code{bool}.
16966+ It is a \DynamicError{dynamic error}
16967+ if the run-time type of $o_1$ is not \code{bool}.
1695816968If $o_1$ is the \TRUE{} object, then the value of $c$ is
1695916969the result of evaluating the expression $e_2$.
1696016970Otherwise, the value of $c$ is the result of evaluating the expression $e_3$.
@@ -17022,23 +17032,27 @@ \subsection{Logical Boolean Expressions}
1702217032\code{$e_1$\,\,||\,\,$e_2$}
1702317033causes the evaluation of $e_1$ to an object $o_1$.
1702417034% This error can occur due to an implicit downcast from \DYNAMIC.
17025- 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}.
1702617037If $o_1$ is \TRUE, the result of evaluating $b$ is \TRUE,
1702717038otherwise $e_2$ is evaluated to an object $o_2$.
1702817039% This error can occur due to an implicit downcast from \DYNAMIC.
17029- 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}.
1703017042Otherwise the result of evaluating $b$ is $o_2$.
1703117043
1703217044\LMHash{}%
1703317045Evaluation of a logical boolean expression $b$ of the form
1703417046\code{$e_1$\,\,\&\&\,\,$e_2$}
1703517047causes the evaluation of $e_1$ to an object $o_1$.
1703617048% This error can occur due to an implicit downcast from \DYNAMIC.
17037- It is a dynamic error if the run-time type of $o_1$ is not \code{bool}.
17049+ It is a \DynamicError{dynamic error}
17050+ if the run-time type of $o_1$ is not \code{bool}.
1703817051If $o_1$ is \FALSE, the result of evaluating $b$ is \FALSE,
1703917052otherwise $e_2$ is evaluated to an object $o_2$.
1704017053% This error can occur due to an implicit downcast from \DYNAMIC.
17041- It is a dynamic error if the run-time type of $o_2$ is not \code{bool}.
17054+ It is a \DynamicError{dynamic error}
17055+ if the run-time type of $o_2$ is not \code{bool}.
1704217056Otherwise the result of evaluating $b$ is $o_2$.
1704317057
1704417058
@@ -17623,7 +17637,7 @@ \subsection{Postfix Expressions}
1762317637
1762417638\LMHash{}%
1762517639$e$ is evaluated as follows: $e_1$ is evaluated to an object $o$.
17626- If $o$ is the null object then a dynamic error occurs,
17640+ If $o$ is the null object then a \DynamicError{ dynamic error} occurs,
1762717641otherwise $e$ evaluates to $o$.
1762817642\EndCase
1762917643
@@ -18951,7 +18965,7 @@ \subsection{Local Variable Declaration}
1895118965then $v$ is bound to $o$.
1895218966If an object $o$ is assigned to $v$
1895318967in a situation where $v$ is bound to an object $o'$
18954- then a dynamic error occurs
18968+ then a \DynamicError{ dynamic error} occurs
1895518969(\commentary{it does not matter whether $o$ is the same object as $o'$}).
1895618970
1895718971\commentary{%
@@ -19112,7 +19126,8 @@ \subsection{If}
1911219126proceeds as follows:
1911319127Evaluate the expression $e$ to an object $o$.
1911419128% This error can occur due to an implicit downcast from \DYNAMIC.
19115- It is a dynamic error if the run-time type of $o$ is not \code{bool}.
19129+ It is a \DynamicError{dynamic error}
19130+ if the run-time type of $o$ is not \code{bool}.
1911619131If $o$ is \TRUE, then execute the block statement $S_1$,
1911719132otherwise execute the block statement $S_2$.
1911819133
@@ -19195,7 +19210,8 @@ \subsubsection{For Loop}
1919519210\item
1919619211 The expression $[v'/v]c$ is evaluated to an object $o$.
1919719212 % This error can occur due to an implicit downcast from \DYNAMIC.
19198- It is a dynamic error if the run-time type of $o$ is not \code{bool}.
19213+ It is a \DynamicError{dynamic error}
19214+ if the run-time type of $o$ is not \code{bool}.
1919919215 If $o$ is \FALSE, the for loop completes normally.
1920019216 Otherwise, execution continues at step \ref{beginIteration}.
1920119217\item
@@ -19408,7 +19424,8 @@ \subsection{While}
1940819424\LMHash{}%
1940919425The expression $e$ is evaluated to an object $o$.
1941019426% This error can occur due to an implicit downcast from \DYNAMIC.
19411- It is a dynamic error if the run-time type of $o$ is not \code{bool}.
19427+ It is a \DynamicError{dynamic error}
19428+ if the run-time type of $o$ is not \code{bool}.
1941219429
1941319430\LMHash{}%
1941419431If $o$ is \FALSE, then execution of the while statement completes normally
@@ -19459,7 +19476,8 @@ \subsection{Do}
1945919476\LMHash{}%
1946019477Then, the expression $e$ is evaluated to an object $o$.
1946119478% This error can occur due to an implicit downcast from \DYNAMIC.
19462- It is a dynamic error if the run-time type of $o$ is not \code{bool}.
19479+ It is a \DynamicError{dynamic error}
19480+ if the run-time type of $o$ is not \code{bool}.
1946319481If $o$ is \FALSE, execution of the do statement completes normally
1946419482(\ref{statementCompletion}).
1946519483If $o$ is \TRUE, then the do statement is re-executed.
@@ -20150,7 +20168,8 @@ \subsection{Return}
2015020168
2015120169\LMHash{}%
2015220170The expression $e$ is evaluated to an object $o$.
20153- A dynamic error occurs unless the dynamic type of $o$ is a subtype of
20171+ A \DynamicError{dynamic error} occurs
20172+ unless the dynamic type of $o$ is a subtype of
2015420173the actual return type of $f$
2015520174(\ref{actualTypes}).
2015620175Then the return statement $s$ completes returning $o$
@@ -20177,7 +20196,8 @@ \subsection{Return}
2017720196let \code{v} be a fresh variable bound to $o$ and
2017820197evaluate \code{\AWAIT{} v} to an object $r$;
2017920198otherwise let $r$ be $o$.
20180- A dynamic error occurs unless the dynamic type of $r$
20199+ A \DynamicError{dynamic error} occurs
20200+ unless the dynamic type of $r$
2018120201is a subtype of the actual value of $T_v$
2018220202(\ref{actualTypes}).
2018320203Then the return statement $s$ completes returning $r$
@@ -21062,28 +21082,28 @@ \subsubsection{Semantics of Imports}
2106221082 \NamespaceName{\metavar{import},i},
2106321083 a corresponding function named \id{} with the same function header as $f$.
2106421084 % This error can occur because being-loaded is a dynamic property.
21065- Calling the function results in a dynamic error,
21085+ Calling the function results in a \DynamicError{ dynamic error} ,
2106621086 and so does closurizing it
2106721087 (\ref{functionClosurization}).
2106821088\item
2106921089 For every top level getter $g$ named \id{} in
2107021090 \NamespaceName{\metavar{import},i},
2107121091 a corresponding getter named \id{} with the same function header as $g$.
2107221092 % This error can occur because being-loaded is a dynamic property.
21073- Calling the getter results in a dynamic error.
21093+ Calling the getter results in a \DynamicError{ dynamic error} .
2107421094\item
2107521095 For every top level setter $s$ named \code{\id=} in
2107621096 \NamespaceName{\metavar{import},i},
2107721097 a corresponding setter named \code{\id=} with
2107821098 the same function header as $s$.
2107921099 % This error can occur because being-loaded is a dynamic property.
21080- Calling the setter results in a dynamic error.
21100+ Calling the setter results in a \DynamicError{ dynamic error} .
2108121101\item
2108221102 For every class, mixin, enum, and type alias declaration named \id{} in
2108321103 \NamespaceName{\metavar{import},i},
2108421104 a corresponding getter named \id{} with return type \code{Type}.
2108521105 % This error can occur because being-loaded is a dynamic property.
21086- Calling the getter results in a dynamic error.
21106+ Calling the getter results in a \DynamicError{ dynamic error} .
2108721107\end{itemize}
2108821108
2108921109\rationale{%
@@ -21617,7 +21637,7 @@ \subsection{Scripts}
2161721637 that spawned $i$%
2161821638 }),
2161921639 or the null object if no such object was supplied.
21620- A dynamic error occurs if
21640+ A \DynamicError{ dynamic error} occurs if
2162121641 the run-time type of this object is not a subtype of
2162221642 the declared type of the corresponding parameter of \code{main}.
2162321643\end{itemize}
@@ -21640,7 +21660,7 @@ \subsection{Scripts}
2164021660(\commentary{%
2164121661the above rules ensure that the corresponding parameters are optional%
2164221662}).
21643- But the implementation must ensure that a dynamic error occurs
21663+ But the implementation must ensure that a \DynamicError{ dynamic error} occurs
2164421664if an actual argument does not have a run-time type which is
2164521665a subtype of the declared type of the parameter.
2164621666
0 commit comments