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}\\
70
71
% error anyway; change extension names to `typeIdentifier`, avoiding
71
72
% built-in identifiers).
72
73
%
73
- % Feb 2023
74
+ % Jan, Feb 2023
74
75
% - Change the specification of constant expressions of the form `e1 == e2`
75
76
% 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.
76
79
%
77
80
% Dec 2022
78
81
% - Change the definition of the type function 'flatten' to resolve soundness
@@ -1585,7 +1588,7 @@ \subsection{Implicitly Induced Getters and Setters}
1585
1588
will bind \id{} to the object that the argument $x$ is bound to.
1586
1589
An execution of the setter
1587
1590
in 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} .
1589
1592
\EndCase
1590
1593
1591
1594
\LMHash{}%
@@ -4178,7 +4181,7 @@ \subsubsection{Generative Constructors}
4178
4181
% This can occur due to a failing implicit cast.
4179
4182
unless the assigned object has a dynamic type
4180
4183
which 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.
4182
4185
4183
4186
\commentary{%
4184
4187
The above rule allows initializing formals to be used as optional parameters:%
@@ -10469,7 +10472,7 @@ \subsubsection{Collection Literal Element Evaluation}
10469
10472
or the given \code{value} does not have the type \code{Value},
10470
10473
but it cannot occur after the pair has been appended to $s$.
10471
10474
\item
10472
- Otherwise, a dynamic error occurs.
10475
+ Otherwise, a \DynamicError{ dynamic error} occurs.
10473
10476
10474
10477
\commentary{%
10475
10478
This occurs when the target is an iterable respectively a map,
@@ -10524,7 +10527,8 @@ \subsubsection{Collection Literal Element Evaluation}
10524
10527
and if $\ell_2$ is not present then
10525
10528
$\EvaluateElement{\ell} := \LiteralSequence{}$.
10526
10529
% $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.
10528
10532
\EndCase
10529
10533
10530
10534
\LMHash{}%
@@ -10755,7 +10759,7 @@ \subsubsection{Lists}
10755
10759
An empty list has an empty set of indices.
10756
10760
A non-empty list has the index set $\{0, \ldots, n - 1\}$
10757
10761
where $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
10759
10763
using an index that is not a member of its set of indices.
10760
10764
10761
10765
\rationale{%
@@ -10779,7 +10783,8 @@ \subsubsection{Lists}
10779
10783
Only run-time list literals can be mutated
10780
10784
after they are created.
10781
10785
% 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}.
10783
10788
10784
10789
\commentary{%
10785
10790
% The following is true either directly or indirectly: There is a \CONST{}
@@ -11548,7 +11553,7 @@ \subsubsection{Sets}
11548
11553
\LMHash{}%
11549
11554
A set may contain zero or more objects.
11550
11555
Sets 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.
11552
11557
Otherwise, when inserting an object $o_{\metavar{new}}$ into a set $s$,
11553
11558
if an object $o_{\metavar{old}}$ exists in $s$ such that
11554
11559
\code{$o_{\metavar{old}}$ == $o_{\metavar{new}}$} evaluates to \TRUE{}
@@ -11588,7 +11593,8 @@ \subsubsection{Sets}
11588
11593
and it is evaluated at run time.
11589
11594
Only run-time set literals can be mutated after they are created.
11590
11595
% 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}.
11592
11598
11593
11599
\commentary{%
11594
11600
% The following is true either directly or indirectly: There is a \CONST{}
@@ -11794,7 +11800,8 @@ \subsubsection{Maps}
11794
11800
and it is evaluated at run time.
11795
11801
Only run-time map literals can be mutated after they are created.
11796
11802
% 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}.
11798
11805
11799
11806
\commentary{%
11800
11807
% The following is true either directly or indirectly: There is a \CONST{}
@@ -11935,7 +11942,8 @@ \subsection{Throw}
11935
11942
}
11936
11943
11937
11944
\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.
11939
11947
Otherwise let $t$ be a stack trace corresponding to the current execution state,
11940
11948
and the \THROW{} statement throws with $v$ as exception object
11941
11949
and $t$ as stack trace (\ref{expressionEvaluation}).
@@ -12455,7 +12463,7 @@ \subsubsection{New}
12455
12463
% This error can occur because being-loaded is a dynamic property.
12456
12464
If $T$ is a deferred type with prefix $p$,
12457
12465
then if $p$ has not been successfully loaded,
12458
- a dynamic error occurs.
12466
+ a \DynamicError{ dynamic error} occurs.
12459
12467
\EndCase
12460
12468
12461
12469
\LMHash{}%
@@ -13384,7 +13392,7 @@ \subsubsection{Binding Actuals to Formals}
13384
13392
If $r = 0$ and $s > 0$ then
13385
13393
if $f$ does not have default type arguments
13386
13394
(\ref{instantiationToBound})
13387
- then a dynamic error occurs.
13395
+ then a \DynamicError{ dynamic error} occurs.
13388
13396
Otherwise replace the actual type argument list:
13389
13397
Let $r$ be $s$ and let $t_i$ for $i \in 1 .. s$ be the result of
13390
13398
instantiation to bound
@@ -16407,7 +16415,8 @@ \subsection{Assignment}
16407
16415
in which case $v$ has no initializer and is not definitely assigned,
16408
16416
or a compile-time error would have occurred%
16409
16417
}).
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.
16411
16420
Otherwise, $v$ is bound to $o$, and then $a$ evaluates to $o$
16412
16421
(\ref{expressionEvaluation}).
16413
16422
\item
@@ -16959,7 +16968,8 @@ \subsection{Conditional}
16959
16968
proceeds as follows:
16960
16969
Evaluate $e_1$ to an object $o_1$.
16961
16970
% 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}.
16963
16973
If $o_1$ is the \TRUE{} object, then the value of $c$ is
16964
16974
the result of evaluating the expression $e_2$.
16965
16975
Otherwise, the value of $c$ is the result of evaluating the expression $e_3$.
@@ -17027,23 +17037,27 @@ \subsection{Logical Boolean Expressions}
17027
17037
\code{$e_1$\,\,||\,\,$e_2$}
17028
17038
causes the evaluation of $e_1$ to an object $o_1$.
17029
17039
% 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}.
17031
17042
If $o_1$ is \TRUE, the result of evaluating $b$ is \TRUE,
17032
17043
otherwise $e_2$ is evaluated to an object $o_2$.
17033
17044
% 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}.
17035
17047
Otherwise the result of evaluating $b$ is $o_2$.
17036
17048
17037
17049
\LMHash{}%
17038
17050
Evaluation of a logical boolean expression $b$ of the form
17039
17051
\code{$e_1$\,\,\&\&\,\,$e_2$}
17040
17052
causes the evaluation of $e_1$ to an object $o_1$.
17041
17053
% 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}.
17043
17056
If $o_1$ is \FALSE, the result of evaluating $b$ is \FALSE,
17044
17057
otherwise $e_2$ is evaluated to an object $o_2$.
17045
17058
% 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}.
17047
17061
Otherwise the result of evaluating $b$ is $o_2$.
17048
17062
17049
17063
@@ -17628,7 +17642,7 @@ \subsection{Postfix Expressions}
17628
17642
17629
17643
\LMHash{}%
17630
17644
$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,
17632
17646
otherwise $e$ evaluates to $o$.
17633
17647
\EndCase
17634
17648
@@ -18960,7 +18974,7 @@ \subsection{Local Variable Declaration}
18960
18974
then $v$ is bound to $o$.
18961
18975
If an object $o$ is assigned to $v$
18962
18976
in a situation where $v$ is bound to an object $o'$
18963
- then a dynamic error occurs
18977
+ then a \DynamicError{ dynamic error} occurs
18964
18978
(\commentary{it does not matter whether $o$ is the same object as $o'$}).
18965
18979
18966
18980
\commentary{%
@@ -19121,7 +19135,8 @@ \subsection{If}
19121
19135
proceeds as follows:
19122
19136
Evaluate the expression $e$ to an object $o$.
19123
19137
% 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}.
19125
19140
If $o$ is \TRUE, then execute the block statement $S_1$,
19126
19141
otherwise execute the block statement $S_2$.
19127
19142
@@ -19204,7 +19219,8 @@ \subsubsection{For Loop}
19204
19219
\item
19205
19220
The expression $[v'/v]c$ is evaluated to an object $o$.
19206
19221
% 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}.
19208
19224
If $o$ is \FALSE, the for loop completes normally.
19209
19225
Otherwise, execution continues at step \ref{beginIteration}.
19210
19226
\item
@@ -19417,7 +19433,8 @@ \subsection{While}
19417
19433
\LMHash{}%
19418
19434
The expression $e$ is evaluated to an object $o$.
19419
19435
% 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}.
19421
19438
19422
19439
\LMHash{}%
19423
19440
If $o$ is \FALSE, then execution of the while statement completes normally
@@ -19468,7 +19485,8 @@ \subsection{Do}
19468
19485
\LMHash{}%
19469
19486
Then, the expression $e$ is evaluated to an object $o$.
19470
19487
% 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}.
19472
19490
If $o$ is \FALSE, execution of the do statement completes normally
19473
19491
(\ref{statementCompletion}).
19474
19492
If $o$ is \TRUE, then the do statement is re-executed.
@@ -20159,7 +20177,8 @@ \subsection{Return}
20159
20177
20160
20178
\LMHash{}%
20161
20179
The 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
20163
20182
the actual return type of $f$
20164
20183
(\ref{actualTypes}).
20165
20184
Then the return statement $s$ completes returning $o$
@@ -20186,7 +20205,8 @@ \subsection{Return}
20186
20205
let \code{v} be a fresh variable bound to $o$ and
20187
20206
evaluate \code{\AWAIT{} v} to an object $r$;
20188
20207
otherwise 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$
20190
20210
is a subtype of the actual value of $T_v$
20191
20211
(\ref{actualTypes}).
20192
20212
Then the return statement $s$ completes returning $r$
@@ -21073,28 +21093,28 @@ \subsubsection{Semantics of Imports}
21073
21093
\NamespaceName{\metavar{import},i},
21074
21094
a corresponding function named \id{} with the same function header as $f$.
21075
21095
% 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} ,
21077
21097
and so does closurizing it
21078
21098
(\ref{functionClosurization}).
21079
21099
\item
21080
21100
For every top level getter $g$ named \id{} in
21081
21101
\NamespaceName{\metavar{import},i},
21082
21102
a corresponding getter named \id{} with the same function header as $g$.
21083
21103
% 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} .
21085
21105
\item
21086
21106
For every top level setter $s$ named \code{\id=} in
21087
21107
\NamespaceName{\metavar{import},i},
21088
21108
a corresponding setter named \code{\id=} with
21089
21109
the same function header as $s$.
21090
21110
% 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} .
21092
21112
\item
21093
21113
For every class, mixin, enum, and type alias declaration named \id{} in
21094
21114
\NamespaceName{\metavar{import},i},
21095
21115
a corresponding getter named \id{} with return type \code{Type}.
21096
21116
% 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} .
21098
21118
\end{itemize}
21099
21119
21100
21120
\rationale{%
@@ -21628,7 +21648,7 @@ \subsection{Scripts}
21628
21648
that spawned $i$%
21629
21649
}),
21630
21650
or the null object if no such object was supplied.
21631
- A dynamic error occurs if
21651
+ A \DynamicError{ dynamic error} occurs if
21632
21652
the run-time type of this object is not a subtype of
21633
21653
the declared type of the corresponding parameter of \code{main}.
21634
21654
\end{itemize}
@@ -21651,7 +21671,7 @@ \subsection{Scripts}
21651
21671
(\commentary{%
21652
21672
the above rules ensure that the corresponding parameters are optional%
21653
21673
}).
21654
- But the implementation must ensure that a dynamic error occurs
21674
+ But the implementation must ensure that a \DynamicError{ dynamic error} occurs
21655
21675
if an actual argument does not have a run-time type which is
21656
21676
a subtype of the declared type of the parameter.
21657
21677
0 commit comments