12
12
\usepackage[T1]{fontenc}
13
13
\usepackage{makeidx}
14
14
\usepackage{enumitem}
15
+ \usepackage{marvosym}
15
16
\makeindex
16
17
\title{Dart Programming Language Specification\\
17
18
{6th edition draft}\\
60
61
% - Clarify how line breaks are handled in a multi-line string literal. Rename
61
62
% the lexical token NEWLINE to LINE\_BREAK (clarifying that it is not `\n`).
62
63
%
63
- % Feb 2023
64
+ % Jan, Feb 2023
64
65
% - Change the specification of constant expressions of the form `e1 == e2`
65
66
% 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.
66
69
%
67
70
% Dec 2022
68
71
% - Change the definition of the type function 'flatten' to resolve soundness
@@ -1575,7 +1578,7 @@ \subsection{Implicitly Induced Getters and Setters}
1575
1578
will bind \id{} to the object that the argument $x$ is bound to.
1576
1579
An execution of the setter
1577
1580
in 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} .
1579
1582
\EndCase
1580
1583
1581
1584
\LMHash{}%
@@ -4158,7 +4161,7 @@ \subsubsection{Generative Constructors}
4158
4161
% This can occur due to a failing implicit cast.
4159
4162
unless the assigned object has a dynamic type
4160
4163
which 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.
4162
4165
4163
4166
\commentary{%
4164
4167
The above rule allows initializing formals to be used as optional parameters:%
@@ -10451,7 +10454,7 @@ \subsubsection{Collection Literal Element Evaluation}
10451
10454
or the given \code{value} does not have the type \code{Value},
10452
10455
but it cannot occur after the pair has been appended to $s$.
10453
10456
\item
10454
- Otherwise, a dynamic error occurs.
10457
+ Otherwise, a \DynamicError{ dynamic error} occurs.
10455
10458
10456
10459
\commentary{%
10457
10460
This occurs when the target is an iterable respectively a map,
@@ -10506,7 +10509,8 @@ \subsubsection{Collection Literal Element Evaluation}
10506
10509
and if $\ell_2$ is not present then
10507
10510
$\EvaluateElement{\ell} := \LiteralSequence{}$.
10508
10511
% $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.
10510
10514
\EndCase
10511
10515
10512
10516
\LMHash{}%
@@ -10737,7 +10741,7 @@ \subsubsection{Lists}
10737
10741
An empty list has an empty set of indices.
10738
10742
A non-empty list has the index set $\{0, \ldots, n - 1\}$
10739
10743
where $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
10741
10745
using an index that is not a member of its set of indices.
10742
10746
10743
10747
\rationale{%
@@ -10761,7 +10765,8 @@ \subsubsection{Lists}
10761
10765
Only run-time list literals can be mutated
10762
10766
after they are created.
10763
10767
% 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}.
10765
10770
10766
10771
\commentary{%
10767
10772
% The following is true either directly or indirectly: There is a \CONST{}
@@ -11530,7 +11535,7 @@ \subsubsection{Sets}
11530
11535
\LMHash{}%
11531
11536
A set may contain zero or more objects.
11532
11537
Sets 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.
11534
11539
Otherwise, when inserting an object $o_{\metavar{new}}$ into a set $s$,
11535
11540
if an object $o_{\metavar{old}}$ exists in $s$ such that
11536
11541
\code{$o_{\metavar{old}}$ == $o_{\metavar{new}}$} evaluates to \TRUE{}
@@ -11570,7 +11575,8 @@ \subsubsection{Sets}
11570
11575
and it is evaluated at run time.
11571
11576
Only run-time set literals can be mutated after they are created.
11572
11577
% 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}.
11574
11580
11575
11581
\commentary{%
11576
11582
% The following is true either directly or indirectly: There is a \CONST{}
@@ -11776,7 +11782,8 @@ \subsubsection{Maps}
11776
11782
and it is evaluated at run time.
11777
11783
Only run-time map literals can be mutated after they are created.
11778
11784
% 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}.
11780
11787
11781
11788
\commentary{%
11782
11789
% The following is true either directly or indirectly: There is a \CONST{}
@@ -11917,7 +11924,8 @@ \subsection{Throw}
11917
11924
}
11918
11925
11919
11926
\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.
11921
11929
Otherwise let $t$ be a stack trace corresponding to the current execution state,
11922
11930
and the \THROW{} statement throws with $v$ as exception object
11923
11931
and $t$ as stack trace (\ref{expressionEvaluation}).
@@ -12437,7 +12445,7 @@ \subsubsection{New}
12437
12445
% This error can occur because being-loaded is a dynamic property.
12438
12446
If $T$ is a deferred type with prefix $p$,
12439
12447
then if $p$ has not been successfully loaded,
12440
- a dynamic error occurs.
12448
+ a \DynamicError{ dynamic error} occurs.
12441
12449
\EndCase
12442
12450
12443
12451
\LMHash{}%
@@ -13365,7 +13373,7 @@ \subsubsection{Binding Actuals to Formals}
13365
13373
If $r = 0$ and $s > 0$ then
13366
13374
if $f$ does not have default type arguments
13367
13375
(\ref{instantiationToBound})
13368
- then a dynamic error occurs.
13376
+ then a \DynamicError{ dynamic error} occurs.
13369
13377
Otherwise replace the actual type argument list:
13370
13378
Let $r$ be $s$ and let $t_i$ for $i \in 1 .. s$ be the result of
13371
13379
instantiation to bound
@@ -16388,7 +16396,8 @@ \subsection{Assignment}
16388
16396
in which case $v$ has no initializer and is not definitely assigned,
16389
16397
or a compile-time error would have occurred%
16390
16398
}).
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.
16392
16401
Otherwise, $v$ is bound to $o$, and then $a$ evaluates to $o$
16393
16402
(\ref{expressionEvaluation}).
16394
16403
\item
@@ -16940,7 +16949,8 @@ \subsection{Conditional}
16940
16949
proceeds as follows:
16941
16950
Evaluate $e_1$ to an object $o_1$.
16942
16951
% 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}.
16944
16954
If $o_1$ is the \TRUE{} object, then the value of $c$ is
16945
16955
the result of evaluating the expression $e_2$.
16946
16956
Otherwise, the value of $c$ is the result of evaluating the expression $e_3$.
@@ -17008,23 +17018,27 @@ \subsection{Logical Boolean Expressions}
17008
17018
\code{$e_1$\,\,||\,\,$e_2$}
17009
17019
causes the evaluation of $e_1$ to an object $o_1$.
17010
17020
% 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}.
17012
17023
If $o_1$ is \TRUE, the result of evaluating $b$ is \TRUE,
17013
17024
otherwise $e_2$ is evaluated to an object $o_2$.
17014
17025
% 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}.
17016
17028
Otherwise the result of evaluating $b$ is $o_2$.
17017
17029
17018
17030
\LMHash{}%
17019
17031
Evaluation of a logical boolean expression $b$ of the form
17020
17032
\code{$e_1$\,\,\&\&\,\,$e_2$}
17021
17033
causes the evaluation of $e_1$ to an object $o_1$.
17022
17034
% 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}.
17024
17037
If $o_1$ is \FALSE, the result of evaluating $b$ is \FALSE,
17025
17038
otherwise $e_2$ is evaluated to an object $o_2$.
17026
17039
% 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}.
17028
17042
Otherwise the result of evaluating $b$ is $o_2$.
17029
17043
17030
17044
@@ -17609,7 +17623,7 @@ \subsection{Postfix Expressions}
17609
17623
17610
17624
\LMHash{}%
17611
17625
$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,
17613
17627
otherwise $e$ evaluates to $o$.
17614
17628
\EndCase
17615
17629
@@ -18937,7 +18951,7 @@ \subsection{Local Variable Declaration}
18937
18951
then $v$ is bound to $o$.
18938
18952
If an object $o$ is assigned to $v$
18939
18953
in a situation where $v$ is bound to an object $o'$
18940
- then a dynamic error occurs
18954
+ then a \DynamicError{ dynamic error} occurs
18941
18955
(\commentary{it does not matter whether $o$ is the same object as $o'$}).
18942
18956
18943
18957
\commentary{%
@@ -19098,7 +19112,8 @@ \subsection{If}
19098
19112
proceeds as follows:
19099
19113
Evaluate the expression $e$ to an object $o$.
19100
19114
% 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}.
19102
19117
If $o$ is \TRUE, then execute the block statement $S_1$,
19103
19118
otherwise execute the block statement $S_2$.
19104
19119
@@ -19181,7 +19196,8 @@ \subsubsection{For Loop}
19181
19196
\item
19182
19197
The expression $[v'/v]c$ is evaluated to an object $o$.
19183
19198
% 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}.
19185
19201
If $o$ is \FALSE, the for loop completes normally.
19186
19202
Otherwise, execution continues at step \ref{beginIteration}.
19187
19203
\item
@@ -19394,7 +19410,8 @@ \subsection{While}
19394
19410
\LMHash{}%
19395
19411
The expression $e$ is evaluated to an object $o$.
19396
19412
% 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}.
19398
19415
19399
19416
\LMHash{}%
19400
19417
If $o$ is \FALSE, then execution of the while statement completes normally
@@ -19445,7 +19462,8 @@ \subsection{Do}
19445
19462
\LMHash{}%
19446
19463
Then, the expression $e$ is evaluated to an object $o$.
19447
19464
% 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}.
19449
19467
If $o$ is \FALSE, execution of the do statement completes normally
19450
19468
(\ref{statementCompletion}).
19451
19469
If $o$ is \TRUE, then the do statement is re-executed.
@@ -20136,7 +20154,8 @@ \subsection{Return}
20136
20154
20137
20155
\LMHash{}%
20138
20156
The 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
20140
20159
the actual return type of $f$
20141
20160
(\ref{actualTypes}).
20142
20161
Then the return statement $s$ completes returning $o$
@@ -20163,7 +20182,8 @@ \subsection{Return}
20163
20182
let \code{v} be a fresh variable bound to $o$ and
20164
20183
evaluate \code{\AWAIT{} v} to an object $r$;
20165
20184
otherwise 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$
20167
20187
is a subtype of the actual value of $T_v$
20168
20188
(\ref{actualTypes}).
20169
20189
Then the return statement $s$ completes returning $r$
@@ -21048,28 +21068,28 @@ \subsubsection{Semantics of Imports}
21048
21068
\NamespaceName{\metavar{import},i},
21049
21069
a corresponding function named \id{} with the same function header as $f$.
21050
21070
% 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} ,
21052
21072
and so does closurizing it
21053
21073
(\ref{functionClosurization}).
21054
21074
\item
21055
21075
For every top level getter $g$ named \id{} in
21056
21076
\NamespaceName{\metavar{import},i},
21057
21077
a corresponding getter named \id{} with the same function header as $g$.
21058
21078
% 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} .
21060
21080
\item
21061
21081
For every top level setter $s$ named \code{\id=} in
21062
21082
\NamespaceName{\metavar{import},i},
21063
21083
a corresponding setter named \code{\id=} with
21064
21084
the same function header as $s$.
21065
21085
% 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} .
21067
21087
\item
21068
21088
For every class, mixin, enum, and type alias declaration named \id{} in
21069
21089
\NamespaceName{\metavar{import},i},
21070
21090
a corresponding getter named \id{} with return type \code{Type}.
21071
21091
% 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} .
21073
21093
\end{itemize}
21074
21094
21075
21095
\rationale{%
@@ -21603,7 +21623,7 @@ \subsection{Scripts}
21603
21623
that spawned $i$%
21604
21624
}),
21605
21625
or the null object if no such object was supplied.
21606
- A dynamic error occurs if
21626
+ A \DynamicError{ dynamic error} occurs if
21607
21627
the run-time type of this object is not a subtype of
21608
21628
the declared type of the corresponding parameter of \code{main}.
21609
21629
\end{itemize}
@@ -21626,7 +21646,7 @@ \subsection{Scripts}
21626
21646
(\commentary{%
21627
21647
the above rules ensure that the corresponding parameters are optional%
21628
21648
}).
21629
- But the implementation must ensure that a dynamic error occurs
21649
+ But the implementation must ensure that a \DynamicError{ dynamic error} occurs
21630
21650
if an actual argument does not have a run-time type which is
21631
21651
a subtype of the declared type of the parameter.
21632
21652
0 commit comments