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}\\
116
117
% error anyway; change extension names to `typeIdentifier`, avoiding
117
118
% built-in identifiers).
118
119
%
119
- % Feb 2023
120
+ % Jan, Feb 2023
120
121
% - Change the specification of constant expressions of the form `e1 == e2`
121
122
% to use primitive equality.
123
+ % - Introduce `\DynamicError{}`, thus marking every introduction (definition)
124
+ % of a dynamic error by a lightning symbol in the right margin.
122
125
%
123
126
% Dec 2022
124
127
% - Change the definition of the type function 'flatten' to resolve soundness
@@ -1635,7 +1638,7 @@ \subsection{Implicitly Induced Getters and Setters}
1635
1638
will bind \id{} to the object that the argument $x$ is bound to.
1636
1639
An execution of the setter
1637
1640
in a situation where the variable \id{} has been bound to an object
1638
- will incur a dynamic error.
1641
+ will incur a \DynamicError{ dynamic error} .
1639
1642
\EndCase
1640
1643
1641
1644
\LMHash{}%
@@ -4240,7 +4243,7 @@ \subsubsection{Generative Constructors}
4240
4243
% This can occur due to a failing implicit cast.
4241
4244
unless the assigned object has a dynamic type
4242
4245
which is not a subtype of the declared type of the instance variable \id,
4243
- in which case a dynamic error occurs.
4246
+ in which case a \DynamicError{ dynamic error} occurs.
4244
4247
4245
4248
\commentary{%
4246
4249
The above rule allows initializing formals to be used as optional parameters:%
@@ -10614,7 +10617,7 @@ \subsubsection{Collection Literal Element Evaluation}
10614
10617
or the given \code{value} does not have the type \code{Value},
10615
10618
but it cannot occur after the pair has been appended to $s$.
10616
10619
\item
10617
- Otherwise, a dynamic error occurs.
10620
+ Otherwise, a \DynamicError{ dynamic error} occurs.
10618
10621
10619
10622
\commentary{%
10620
10623
This occurs when the target is an iterable respectively a map,
@@ -10669,7 +10672,8 @@ \subsubsection{Collection Literal Element Evaluation}
10669
10672
and if $\ell_2$ is not present then
10670
10673
$\EvaluateElement{\ell} := \LiteralSequence{}$.
10671
10674
% $o_b$ can have type \DYNAMIC.
10672
- If $o_b$ is neither \TRUE{} nor \FALSE{} then a dynamic error occurs.
10675
+ If $o_b$ is neither \TRUE{} nor \FALSE{}
10676
+ then a \DynamicError{dynamic error} occurs.
10673
10677
\EndCase
10674
10678
10675
10679
\LMHash{}%
@@ -10900,7 +10904,7 @@ \subsubsection{Lists}
10900
10904
An empty list has an empty set of indices.
10901
10905
A non-empty list has the index set $\{0, \ldots, n - 1\}$
10902
10906
where $n$ is the size of the list.
10903
- It is a dynamic error to attempt to access a list
10907
+ It is a \DynamicError{ dynamic error} to attempt to access a list
10904
10908
using an index that is not a member of its set of indices.
10905
10909
10906
10910
\rationale{%
@@ -10924,7 +10928,8 @@ \subsubsection{Lists}
10924
10928
Only run-time list literals can be mutated
10925
10929
after they are created.
10926
10930
% This error can occur because being constant is a dynamic property.
10927
- Attempting to mutate a constant list literal will result in a dynamic error.
10931
+ Attempting to mutate a constant list literal
10932
+ will result in a \DynamicError{dynamic error}.
10928
10933
10929
10934
\commentary{%
10930
10935
% The following is true either directly or indirectly: There is a \CONST{}
@@ -11702,7 +11707,7 @@ \subsubsection{Sets}
11702
11707
\LMHash{}%
11703
11708
A set may contain zero or more objects.
11704
11709
Sets have a method which can be used to insert objects;
11705
- this will incur a dynamic error if the set is not modifiable.
11710
+ this will incur a \DynamicError{ dynamic error} if the set is not modifiable.
11706
11711
Otherwise, when inserting an object $o_{\metavar{new}}$ into a set $s$,
11707
11712
if an object $o_{\metavar{old}}$ exists in $s$ such that
11708
11713
\code{$o_{\metavar{old}}$ == $o_{\metavar{new}}$} evaluates to \TRUE{}
@@ -11742,7 +11747,8 @@ \subsubsection{Sets}
11742
11747
and it is evaluated at run time.
11743
11748
Only run-time set literals can be mutated after they are created.
11744
11749
% This error can occur because being constant is a dynamic property, here.
11745
- Attempting to mutate a constant set literal will result in a dynamic error.
11750
+ Attempting to mutate a constant set literal
11751
+ will result in a \DynamicError{dynamic error}.
11746
11752
11747
11753
\commentary{%
11748
11754
% The following is true either directly or indirectly: There is a \CONST{}
@@ -11950,7 +11956,8 @@ \subsubsection{Maps}
11950
11956
and it is evaluated at run time.
11951
11957
Only run-time map literals can be mutated after they are created.
11952
11958
% This error can occur because being constant is a dynamic property, here.
11953
- Attempting to mutate a constant map literal will result in a dynamic error.
11959
+ Attempting to mutate a constant map literal
11960
+ will result in a \DynamicError{dynamic error}.
11954
11961
11955
11962
\commentary{%
11956
11963
% The following is true either directly or indirectly: There is a \CONST{}
@@ -12093,7 +12100,8 @@ \subsection{Throw}
12093
12100
}
12094
12101
12095
12102
\LMHash{}%
12096
- If $v$ is the null object (\ref{null}), then a dynamic error occurs.
12103
+ If $v$ is the null object (\ref{null})
12104
+ then a \DynamicError{dynamic error} occurs.
12097
12105
Otherwise let $t$ be a stack trace corresponding to the current execution state,
12098
12106
and the \THROW{} statement throws with $v$ as exception object
12099
12107
and $t$ as stack trace (\ref{expressionEvaluation}).
@@ -12710,7 +12718,7 @@ \subsubsection{New}
12710
12718
% This error can occur because being-loaded is a dynamic property.
12711
12719
If $T$ is a deferred type with prefix $p$,
12712
12720
then if $p$ has not been successfully loaded,
12713
- a dynamic error occurs.
12721
+ a \DynamicError{ dynamic error} occurs.
12714
12722
\EndCase
12715
12723
12716
12724
\LMHash{}%
@@ -13639,7 +13647,7 @@ \subsubsection{Binding Actuals to Formals}
13639
13647
If $r = 0$ and $s > 0$ then
13640
13648
if $f$ does not have default type arguments
13641
13649
(\ref{instantiationToBound})
13642
- then a dynamic error occurs.
13650
+ then a \DynamicError{ dynamic error} occurs.
13643
13651
Otherwise replace the actual type argument list:
13644
13652
Let $r$ be $s$ and let $t_i$ for $i \in 1 .. s$ be the result of
13645
13653
instantiation to bound
@@ -16722,7 +16730,8 @@ \subsection{Assignment}
16722
16730
(in which case $v$ has no initializer and is not definitely assigned,
16723
16731
or a compile-time error would have occurred)%
16724
16732
}.
16725
- If $v$ has previously been bound to an object then a dynamic error occurs.
16733
+ If $v$ has previously been bound to an object
16734
+ then a \DynamicError{dynamic error} occurs.
16726
16735
Otherwise, $v$ is bound to $o$, and then $a$ evaluates to $o$
16727
16736
(\ref{expressionEvaluation}).
16728
16737
\item
@@ -17275,7 +17284,8 @@ \subsection{Conditional}
17275
17284
proceeds as follows:
17276
17285
Evaluate $e_1$ to an object $o_1$.
17277
17286
% This error can occur due to an implicit cast from \DYNAMIC.
17278
- It is a dynamic error if the run-time type of $o_1$ is not \code{bool}.
17287
+ It is a \DynamicError{dynamic error}
17288
+ if the run-time type of $o_1$ is not \code{bool}.
17279
17289
If $o_1$ is the \TRUE{} object, then the value of $c$ is
17280
17290
the result of evaluating the expression $e_2$.
17281
17291
Otherwise, the value of $c$ is the result of evaluating the expression $e_3$.
@@ -17343,23 +17353,27 @@ \subsection{Logical Boolean Expressions}
17343
17353
\code{$e_1$\,\,||\,\,$e_2$}
17344
17354
causes the evaluation of $e_1$ to an object $o_1$.
17345
17355
% This error can occur due to an implicit downcast from \DYNAMIC.
17346
- It is a dynamic error if the run-time type of $o_1$ is not \code{bool}.
17356
+ It is a \DynamicError{dynamic error}
17357
+ if the run-time type of $o_1$ is not \code{bool}.
17347
17358
If $o_1$ is \TRUE, the result of evaluating $b$ is \TRUE,
17348
17359
otherwise $e_2$ is evaluated to an object $o_2$.
17349
17360
% This error can occur due to an implicit downcast from \DYNAMIC.
17350
- It is a dynamic error if the run-time type of $o_2$ is not \code{bool}.
17361
+ It is a \DynamicError{dynamic error}
17362
+ if the run-time type of $o_2$ is not \code{bool}.
17351
17363
Otherwise the result of evaluating $b$ is $o_2$.
17352
17364
17353
17365
\LMHash{}%
17354
17366
Evaluation of a logical boolean expression $b$ of the form
17355
17367
\code{$e_1$\,\,\&\&\,\,$e_2$}
17356
17368
causes the evaluation of $e_1$ to an object $o_1$.
17357
17369
% This error can occur due to an implicit downcast from \DYNAMIC.
17358
- It is a dynamic error if the run-time type of $o_1$ is not \code{bool}.
17370
+ It is a \DynamicError{dynamic error}
17371
+ if the run-time type of $o_1$ is not \code{bool}.
17359
17372
If $o_1$ is \FALSE, the result of evaluating $b$ is \FALSE,
17360
17373
otherwise $e_2$ is evaluated to an object $o_2$.
17361
17374
% This error can occur due to an implicit downcast from \DYNAMIC.
17362
- It is a dynamic error if the run-time type of $o_2$ is not \code{bool}.
17375
+ It is a \DynamicError{dynamic error}
17376
+ if the run-time type of $o_2$ is not \code{bool}.
17363
17377
Otherwise the result of evaluating $b$ is $o_2$.
17364
17378
17365
17379
@@ -17955,7 +17969,7 @@ \subsection{Postfix Expressions}
17955
17969
17956
17970
\LMHash{}%
17957
17971
$e$ is evaluated as follows: $e_1$ is evaluated to an object $o$.
17958
- If $o$ is the null object then a dynamic error occurs,
17972
+ If $o$ is the null object then a \DynamicError{ dynamic error} occurs,
17959
17973
otherwise $e$ evaluates to $o$.
17960
17974
\EndCase
17961
17975
@@ -19307,7 +19321,7 @@ \subsection{Local Variable Declaration}
19307
19321
then $v$ is bound to $o$.
19308
19322
If an object $o$ is assigned to $v$
19309
19323
in a situation where $v$ is bound to an object $o'$
19310
- then a dynamic error occurs
19324
+ then a \DynamicError{ dynamic error} occurs
19311
19325
\commentary{(it does not matter whether $o$ is the same object as $o'$)}.
19312
19326
19313
19327
\commentary{%
@@ -19468,7 +19482,8 @@ \subsection{If}
19468
19482
proceeds as follows:
19469
19483
Evaluate the expression $e$ to an object $o$.
19470
19484
% 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}.
19485
+ It is a \DynamicError{dynamic error}
19486
+ if the run-time type of $o$ is not \code{bool}.
19472
19487
If $o$ is \TRUE, then execute the block statement $S_1$,
19473
19488
otherwise execute the block statement $S_2$.
19474
19489
@@ -19554,7 +19569,8 @@ \subsubsection{For Loop}
19554
19569
\item
19555
19570
The expression $[v'/v]c$ is evaluated to an object $o$.
19556
19571
% This error can occur due to an implicit downcast from \DYNAMIC.
19557
- It is a dynamic error if the run-time type of $o$ is not \code{bool}.
19572
+ It is a \DynamicError{dynamic error}
19573
+ if the run-time type of $o$ is not \code{bool}.
19558
19574
If $o$ is \FALSE, the for loop completes normally.
19559
19575
Otherwise, execution continues at step \ref{beginIteration}.
19560
19576
\item
@@ -19767,7 +19783,8 @@ \subsection{While}
19767
19783
\LMHash{}%
19768
19784
The expression $e$ is evaluated to an object $o$.
19769
19785
% This error can occur due to an implicit downcast from \DYNAMIC.
19770
- It is a dynamic error if the run-time type of $o$ is not \code{bool}.
19786
+ It is a \DynamicError{dynamic error}
19787
+ if the run-time type of $o$ is not \code{bool}.
19771
19788
19772
19789
\LMHash{}%
19773
19790
If $o$ is \FALSE, then execution of the while statement completes normally
@@ -19818,7 +19835,8 @@ \subsection{Do}
19818
19835
\LMHash{}%
19819
19836
Then, the expression $e$ is evaluated to an object $o$.
19820
19837
% This error can occur due to an implicit downcast from \DYNAMIC.
19821
- It is a dynamic error if the run-time type of $o$ is not \code{bool}.
19838
+ It is a \DynamicError{dynamic error}
19839
+ if the run-time type of $o$ is not \code{bool}.
19822
19840
If $o$ is \FALSE, execution of the do statement completes normally
19823
19841
(\ref{statementCompletion}).
19824
19842
If $o$ is \TRUE, then the do statement is re-executed.
@@ -20576,7 +20594,8 @@ \subsection{Return}
20576
20594
20577
20595
\LMHash{}%
20578
20596
The expression $e$ is evaluated to an object $o$.
20579
- A dynamic error occurs unless the dynamic type of $o$ is a subtype of
20597
+ A \DynamicError{dynamic error} occurs
20598
+ unless the dynamic type of $o$ is a subtype of
20580
20599
the actual return type of $f$
20581
20600
(\ref{actualTypes}).
20582
20601
Then the return statement $s$ completes returning $o$
@@ -20604,7 +20623,8 @@ \subsection{Return}
20604
20623
let \code{v} be a fresh variable bound to $o$ and
20605
20624
evaluate \code{\AWAIT{} v} to an object $r$;
20606
20625
otherwise let $r$ be $o$.
20607
- A dynamic error occurs unless the dynamic type of $r$
20626
+ A \DynamicError{dynamic error} occurs
20627
+ unless the dynamic type of $r$
20608
20628
is a subtype of the actual value of $T_v$
20609
20629
(\ref{actualTypes}).
20610
20630
Then the return statement $s$ completes returning $r$
@@ -21506,21 +21526,21 @@ \subsubsection{Semantics of Imports}
21506
21526
\NamespaceName{\metavar{import},i},
21507
21527
a corresponding getter named \id{} with the same function header as $g$.
21508
21528
% This error can occur because being-loaded is a dynamic property.
21509
- Calling the getter results in a dynamic error.
21529
+ Calling the getter results in a \DynamicError{ dynamic error} .
21510
21530
\item
21511
21531
For every top level setter $s$ named \code{\id=} in
21512
21532
\NamespaceName{\metavar{import},i},
21513
21533
a corresponding setter named \code{\id=} with
21514
21534
the same function header as $s$.
21515
21535
% This error can occur because being-loaded is a dynamic property.
21516
- Calling the setter results in a dynamic error that occurs before
21517
- the actual argument is evaluated.
21536
+ Calling the setter results in a \DynamicError{ dynamic error}
21537
+ that occurs before the actual argument is evaluated.
21518
21538
\item
21519
21539
For every class, mixin, enum, and type alias declaration named \id{} in
21520
21540
\NamespaceName{\metavar{import},i},
21521
21541
a corresponding getter named \id{} with return type \code{Type}.
21522
21542
% This error can occur because being-loaded is a dynamic property.
21523
- Calling the getter results in a dynamic error.
21543
+ Calling the getter results in a \DynamicError{ dynamic error} .
21524
21544
\end{itemize}
21525
21545
21526
21546
\rationale{%
@@ -22059,7 +22079,7 @@ \subsection{Scripts}
22059
22079
that spawned $i$)%
22060
22080
},
22061
22081
or the null object if no such object was supplied.
22062
- A dynamic error occurs if
22082
+ A \DynamicError{ dynamic error} occurs if
22063
22083
the run-time type of this object is not a subtype of
22064
22084
the declared type of the corresponding parameter of \code{main}.
22065
22085
\end{itemize}
@@ -22082,7 +22102,7 @@ \subsection{Scripts}
22082
22102
\commentary{%
22083
22103
(the above rules ensure that the corresponding parameters are optional)%
22084
22104
}.
22085
- But the implementation must ensure that a dynamic error occurs
22105
+ But the implementation must ensure that a \DynamicError{ dynamic error} occurs
22086
22106
if an actual argument does not have a run-time type which is
22087
22107
a subtype of the declared type of the parameter.
22088
22108
0 commit comments