OLD | NEW |
1 \documentclass{article} | 1 \documentclass{article} |
2 \usepackage{epsfig} | 2 \usepackage{epsfig} |
3 \usepackage{color} | 3 \usepackage{color} |
4 \usepackage{dart} | 4 \usepackage{dart} |
5 \usepackage{bnf} | 5 \usepackage{bnf} |
6 \usepackage{hyperref} | 6 \usepackage{hyperref} |
7 \usepackage{lmodern} | 7 \usepackage{lmodern} |
8 \usepackage[T1]{fontenc} | 8 \usepackage[T1]{fontenc} |
9 \newcommand{\code}[1]{{\sf #1}} | 9 \newcommand{\code}[1]{{\sf #1}} |
10 \title{Dart Programming Language Specification \\ | 10 \title{Dart Programming Language Specification \\ |
11 {5th edition draft}\\ | 11 {5th edition draft}\\ |
12 {\large Version 2.0.0-dev}} | 12 {\large Version 2.0.0-dev}} |
13 | 13 |
14 % For information about Location Markers (and in particular the | 14 % For information about Location Markers (and in particular the |
15 % commands \LMHash and \LMLabel), see the long comment at the | 15 % commands \LMHash and \LMLabel), see the long comment at the |
16 % end of this file. | 16 % end of this file. |
17 | 17 |
18 % CHANGES | 18 % CHANGES |
19 % ======= | 19 % ======= |
20 % Significant changes to the specification. | 20 % Significant changes to the specification. |
21 % | 21 % |
22 % 2.0 | 22 % 2.0 |
23 % - Don't allow functions as assert test values. | 23 % - Don't allow functions as assert test values. |
24 % - Start running "async" functions synchronously. | 24 % - Start running "async" functions synchronously. |
25 % - It is a static warning and dynamic error to assign to a final local. | 25 % - It is a static warning and dynamic error to assign to a final local. |
26 % - Specify what "is equivalent to" means. | 26 % - Specify what "is equivalent to" means. |
| 27 % - Remove @proxy. |
27 % | 28 % |
28 % 1.15 | 29 % 1.15 |
29 % - Change how language specification describes control flow. | 30 % - Change how language specification describes control flow. |
30 % - Object initialization now specifies initialization order correctly. | 31 % - Object initialization now specifies initialization order correctly. |
31 % - Specifies that leaving an await-for loop must wait for the subscription | 32 % - Specifies that leaving an await-for loop must wait for the subscription |
32 % to be canceled. | 33 % to be canceled. |
33 % - An await-for loop only pauses the subscription if it does something async. | 34 % - An await-for loop only pauses the subscription if it does something async. |
34 % - Assert statements allows a "message" operand and a trailing comma. | 35 % - Assert statements allows a "message" operand and a trailing comma. |
35 % - The Null type is now considered a subtype of all types in most cases. | 36 % - The Null type is now considered a subtype of all types in most cases. |
36 % - Specify what NEWLINE means in multiline strings. | 37 % - Specify what NEWLINE means in multiline strings. |
(...skipping 4092 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4129 \} | 4130 \} |
4130 | 4131 |
4131 \NEW{} Perverse.unknownMethod(); | 4132 \NEW{} Perverse.unknownMethod(); |
4132 \end{code} | 4133 \end{code} |
4133 | 4134 |
4134 \commentary{Notice that the wording carefully avoids re-evaluating the receiver
$o$ and the arguments $a_i$. } | 4135 \commentary{Notice that the wording carefully avoids re-evaluating the receiver
$o$ and the arguments $a_i$. } |
4135 | 4136 |
4136 \LMHash{} | 4137 \LMHash{} |
4137 Let $T$ be the static type of $o$. It is a static type warning if $T$ does not
have an accessible (\ref{privacy}) instance member named $m$ unless either: | 4138 Let $T$ be the static type of $o$. It is a static type warning if $T$ does not
have an accessible (\ref{privacy}) instance member named $m$ unless either: |
4138 \begin{itemize} | 4139 \begin{itemize} |
4139 \item | 4140 \item $T$ is \code{Type}, $e$ is a constant type literal and the class correspo
nding to $e$ has a static getter named $m$. Or |
4140 $T$ or a superinterface of $T$ is annotated with an annotation denoting a consta
nt identical to the constant \code{@proxy} defined in \code{dart:core}. Or | |
4141 \item $T$ is \code{Type}, $e$ is a constant type literal and the class correspo
nding to $e$ has a static getter named $m$. | |
4142 \item $T$ is \code{Function} and $m$ is \CALL. \rationale {The type \code{Functi
on} is treated as if it has a \code{call} method for any possible signature of \
CALL. The expectation is that any concrete subclass of \code{Function} will impl
ement \CALL. Note that a warning will be issued if this is not the case. Further
more, any use of \CALL{} on a subclass of \code{Function} that fails to implemen
t \CALL{} will also provoke a warning, as this exemption is limited to type \cod
e{Function}, and does not apply to its subtypes. | 4141 \item $T$ is \code{Function} and $m$ is \CALL. \rationale {The type \code{Functi
on} is treated as if it has a \code{call} method for any possible signature of \
CALL. The expectation is that any concrete subclass of \code{Function} will impl
ement \CALL. Note that a warning will be issued if this is not the case. Further
more, any use of \CALL{} on a subclass of \code{Function} that fails to implemen
t \CALL{} will also provoke a warning, as this exemption is limited to type \cod
e{Function}, and does not apply to its subtypes. |
4143 } | 4142 } |
4144 \end{itemize} | 4143 \end{itemize} |
4145 | 4144 |
4146 \LMHash{} | 4145 \LMHash{} |
4147 If $T.m$ exists, it is a static type warning if the type $F$ of $T.m$ may not b
e assigned to a function type. If $T.m$ does not exist, or if $F$ is not a funct
ion type, the static type of $i$ is \DYNAMIC{}; otherwise the static type of $i$
is the declared return type of $F$. | 4146 If $T.m$ exists, it is a static type warning if the type $F$ of $T.m$ may not b
e assigned to a function type. If $T.m$ does not exist, or if $F$ is not a funct
ion type, the static type of $i$ is \DYNAMIC{}; otherwise the static type of $i$
is the declared return type of $F$. |
4148 | 4147 |
4149 \LMHash{} | 4148 \LMHash{} |
4150 It is a compile-time error to invoke any of the methods of class \cd{Object} on
a prefix object (\ref{imports}) or on a constant type literal that is immediate
ly followed by the token `.'. | 4149 It is a compile-time error to invoke any of the methods of class \cd{Object} on
a prefix object (\ref{imports}) or on a constant type literal that is immediate
ly followed by the token `.'. |
4151 | 4150 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4222 \item \code{im'.namedArguments} evaluates to the value of \code{\CONST{} \{\}}. | 4221 \item \code{im'.namedArguments} evaluates to the value of \code{\CONST{} \{\}}. |
4223 \end{itemize} | 4222 \end{itemize} |
4224 | 4223 |
4225 and the result of this latter invocation is the result of evaluating $i$. | 4224 and the result of this latter invocation is the result of evaluating $i$. |
4226 | 4225 |
4227 | 4226 |
4228 \LMHash{} | 4227 \LMHash{} |
4229 It is a compile-time error if a super method invocation occurs in a top-level fu
nction or variable initializer, in an instance variable initializer or initializ
er list, in class \code{Object}, in a factory constructor or in a static method
or variable initializer. | 4228 It is a compile-time error if a super method invocation occurs in a top-level fu
nction or variable initializer, in an instance variable initializer or initializ
er list, in class \code{Object}, in a factory constructor or in a static method
or variable initializer. |
4230 | 4229 |
4231 \LMHash{} | 4230 \LMHash{} |
4232 Let $S_{static}$ be the superclass of the immediately enclosing class. It is a s
tatic type warning if $S_{static}$ does not have an accessible (\ref{privacy}) i
nstance member named $m$ unless $S_{static}$ or a superinterface of $S_{static}$
is annotated with an annotation denoting a constant identical to the constant \
code{@proxy} defined in \code{dart:core}. If $S_{static}.m$ exists, it is a sta
tic type warning if the type $F$ of $S_{static}.m$ may not be assigned to a func
tion type. If $S_{static}.m$ does not exist, or if $F$ is not a function type, t
he static type of $i$ is \DYNAMIC{}; otherwise the static type of $i$ is the dec
lared return type of $F$. | 4231 Let $S_{static}$ be the superclass of the immediately enclosing class. It is a s
tatic type warning if $S_{static}$ does not have an accessible (\ref{privacy}) i
nstance member named $m$. If $S_{static}.m$ exists, it is a static type warning
if the type $F$ of $S_{static}.m$ may not be assigned to a function type. If $S
_{static}.m$ does not exist, or if $F$ is not a function type, the static type o
f $i$ is \DYNAMIC{}; otherwise the static type of $i$ is the declared return typ
e of $F$. |
4233 % The following is not needed because it is specified in 'Binding Actuals to For
mals" | 4232 % The following is not needed because it is specified in 'Binding Actuals to For
mals" |
4234 %Let $T_i$ be the static type of $a_i, i \in 1 .. n+k$. It is a static warning i
f $F$ is not a supertype of $(T_1, \ldots, t_n, \{T_{n+1}$ $x_{n+1}, \ldots, T_
{n+k}$ $x_{n+k}\}) \to \bot$. | 4233 %Let $T_i$ be the static type of $a_i, i \in 1 .. n+k$. It is a static warning i
f $F$ is not a supertype of $(T_1, \ldots, t_n, \{T_{n+1}$ $x_{n+1}, \ldots, T_
{n+k}$ $x_{n+k}\}) \to \bot$. |
4235 | 4234 |
4236 | 4235 |
4237 | 4236 |
4238 | 4237 |
4239 \subsubsection{Sending Messages} | 4238 \subsubsection{Sending Messages} |
4240 \LMLabel{sendingMessages} | 4239 \LMLabel{sendingMessages} |
4241 | 4240 |
4242 \LMHash{} | 4241 \LMHash{} |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4319 and the result of this latter invocation is the result of evaluating $i$. | 4318 and the result of this latter invocation is the result of evaluating $i$. |
4320 | 4319 |
4321 \LMHash{} | 4320 \LMHash{} |
4322 It is a compile-time error if $m$ is a member of class \cd{Object} and $e$ is ei
ther a prefix object (\ref{imports}) or a constant type literal. | 4321 It is a compile-time error if $m$ is a member of class \cd{Object} and $e$ is ei
ther a prefix object (\ref{imports}) or a constant type literal. |
4323 | 4322 |
4324 \commentary { | 4323 \commentary { |
4325 This precludes \code{int.toString} but not \code{(int).toString} because in the
latter case, $e$ is a parenthesized expression. | 4324 This precludes \code{int.toString} but not \code{(int).toString} because in the
latter case, $e$ is a parenthesized expression. |
4326 } | 4325 } |
4327 | 4326 |
4328 \LMHash{} | 4327 \LMHash{} |
4329 Let $T$ be the static type of $e$. It is a static type warning if $T$ does not
have a method or getter named $m$ unless either: | 4328 Let $T$ be the static type of $e$. It is a static type warning if $T$ does not
have a method or getter named $m$ unless $T$ is \code{Type}, $e$ is a constant t
ype literal and the class corresponding to $e$ has a static method or getter nam
ed $m$. |
4330 \begin{itemize} | |
4331 \item | |
4332 $T$ or a superinterface of $T$ is annotated with an annotation denoting a consta
nt identical to the constant \code{@proxy} defined in \code{dart:core}. Or | |
4333 \item $T$ is \code{Type}, $e$ is a constant type literal and the class correspo
nding to $e$ has a static method or getter named $m$. | |
4334 \end{itemize} | |
4335 | 4329 |
4336 \LMHash{} | 4330 \LMHash{} |
4337 The static type of $i$ is: | 4331 The static type of $i$ is: |
4338 \begin{itemize} | 4332 \begin{itemize} |
4339 \item The declared return type of $T.m$, if $T$ has an accessible instance gett
er named $m$. | 4333 \item The declared return type of $T.m$, if $T$ has an accessible instance gett
er named $m$. |
4340 \item The declared return type of $m$, if $T$ is \code{Type}, $e$ is a constant
type literal and the class corresponding to $e$ declares an accessible static g
etter named $m$. | 4334 \item The declared return type of $m$, if $T$ is \code{Type}, $e$ is a constant
type literal and the class corresponding to $e$ declares an accessible static g
etter named $m$. |
4341 \item The static type of function $T.m$ if $T$ has an accessible instance method
named $m$. | 4335 \item The static type of function $T.m$ if $T$ has an accessible instance method
named $m$. |
4342 \item The static type of function $m$, if $T$ is \code{Type}, $e$ is a constant
type literal and the class corresponding to $e$ declares an accessible static m
ethod named $m$. | 4336 \item The static type of function $m$, if $T$ is \code{Type}, $e$ is a constant
type literal and the class corresponding to $e$ declares an accessible static m
ethod named $m$. |
4343 \item The type \DYNAMIC{} otherwise. | 4337 \item The type \DYNAMIC{} otherwise. |
4344 \end{itemize} | 4338 \end{itemize} |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4550 \item \code{im'.namedArguments} evaluates to the value of \code{\CONST{} \{\}}. | 4544 \item \code{im'.namedArguments} evaluates to the value of \code{\CONST{} \{\}}. |
4551 \end{itemize} | 4545 \end{itemize} |
4552 | 4546 |
4553 \LMHash{} | 4547 \LMHash{} |
4554 The value of the assignment expression is $o_2$ irrespective of whether setter l
ookup has failed or succeeded. | 4548 The value of the assignment expression is $o_2$ irrespective of whether setter l
ookup has failed or succeeded. |
4555 | 4549 |
4556 \LMHash{} | 4550 \LMHash{} |
4557 In checked mode, it is a dynamic type error if $o_2$ is not \NULL{} and the inte
rface of the class of $o_2$ is not a subtype of the actual type of $e_1.v$. | 4551 In checked mode, it is a dynamic type error if $o_2$ is not \NULL{} and the inte
rface of the class of $o_2$ is not a subtype of the actual type of $e_1.v$. |
4558 | 4552 |
4559 \LMHash{} | 4553 \LMHash{} |
4560 Let $T$ be the static type of $e_1$. It is a static type warning if $T$ does not
have an accessible instance setter named $v=$ unless either: | 4554 Let $T$ be the static type of $e_1$. It is a static type warning if $T$ does not
have an accessible instance setter named $v=$ unless $T$ is \code{Type}, $e_1$
is a constant type literal and the class corresponding to $e_1$ has a static set
ter named $v=$. |
4561 \begin{itemize} | |
4562 \item $T$ or a superinterface of $T$ is annotated with an annotation denoting a
constant identical to the constant \code{@proxy} defined in \code{dart:core}. Or | |
4563 \item $T$ is \code{Type}, $e_1$ is a constant type literal and the class corresp
onding to $e_1$ has a static setter named $v=$. | |
4564 \end{itemize} | |
4565 | |
4566 | 4555 |
4567 | 4556 |
4568 \LMHash{} | 4557 \LMHash{} |
4569 It is a static type warning if the static type of $e_2$ may not be assigned to t
he static type of the formal parameter of the setter $v=$. The static type of
the expression $e_1.v$ \code{=} $e_2$ is the static type of $e_2$. | 4558 It is a static type warning if the static type of $e_2$ may not be assigned to t
he static type of the formal parameter of the setter $v=$. The static type of
the expression $e_1.v$ \code{=} $e_2$ is the static type of $e_2$. |
4570 | 4559 |
4571 \LMHash{} | 4560 \LMHash{} |
4572 Evaluation of an assignment of the form $\SUPER.v$ \code{=} $e$ proceeds as foll
ows: | 4561 Evaluation of an assignment of the form $\SUPER.v$ \code{=} $e$ proceeds as foll
ows: |
4573 | 4562 |
4574 \LMHash{} | 4563 \LMHash{} |
4575 Let $g$ be the method currently executing, and let $C$ be the class in which $g$
was looked up. Let $S_{dynamic}$ be the superclass of $C$. | 4564 Let $g$ be the method currently executing, and let $C$ be the class in which $g$
was looked up. Let $S_{dynamic}$ be the superclass of $C$. |
(...skipping 18 matching lines...) Expand all Loading... |
4594 \item \code{im'.namedArguments} evaluates to the value of \code{\CONST{} \{\}}. | 4583 \item \code{im'.namedArguments} evaluates to the value of \code{\CONST{} \{\}}. |
4595 \end{itemize} | 4584 \end{itemize} |
4596 | 4585 |
4597 \LMHash{} | 4586 \LMHash{} |
4598 The value of the assignment expression is $o$ irrespective of whether setter loo
kup has failed or succeeded. | 4587 The value of the assignment expression is $o$ irrespective of whether setter loo
kup has failed or succeeded. |
4599 | 4588 |
4600 \LMHash{} | 4589 \LMHash{} |
4601 In checked mode, it is a dynamic type error if $o$ is not \NULL{} and the interf
ace of the class of $o$ is not a subtype of the actual type of $S.v$. | 4590 In checked mode, it is a dynamic type error if $o$ is not \NULL{} and the interf
ace of the class of $o$ is not a subtype of the actual type of $S.v$. |
4602 | 4591 |
4603 \LMHash{} | 4592 \LMHash{} |
4604 Let $S_{static}$ be the superclass of the immediately enclosing class. It is a s
tatic type warning if $S_{static}$ does not have an accessible instance setter n
amed $v=$ unless $S_{static}$ or a superinterface of $S_{static}$ is annotated w
ith an annotation denoting a constant identical to the constant \code{@proxy} de
fined in \code{dart:core}. | 4593 Let $S_{static}$ be the superclass of the immediately enclosing class. It is a s
tatic type warning if $S_{static}$ does not have an accessible instance setter n
amed $v=$ unless $S_{static}$. |
4605 | 4594 |
4606 \LMHash{} | 4595 \LMHash{} |
4607 It is a static type warning if the static type of $e$ may not be assigned to the
static type of the formal parameter of the setter $v=$. The static type of th
e expression $\SUPER.v$ \code{=} $e$ is the static type of $e$. | 4596 It is a static type warning if the static type of $e$ may not be assigned to the
static type of the formal parameter of the setter $v=$. The static type of th
e expression $\SUPER.v$ \code{=} $e$ is the static type of $e$. |
4608 | 4597 |
4609 \LMHash{} | 4598 \LMHash{} |
4610 Evaluation of an assignment $e$ of the form \code{$e_1$[$e_2$] = $e_3$} | 4599 Evaluation of an assignment $e$ of the form \code{$e_1$[$e_2$] = $e_3$} |
4611 proceeds as follows: | 4600 proceeds as follows: |
4612 | 4601 |
4613 \LMHash{} | 4602 \LMHash{} |
4614 Evaluate $e_1$ to an object $a$, then evaluate $e_2$ to an object $i$, and final
ly evaluate $e_3$ to an object $v$. | 4603 Evaluate $e_1$ to an object $a$, then evaluate $e_2$ to an object $i$, and final
ly evaluate $e_3$ to an object $v$. |
(...skipping 3654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8269 | 8258 |
8270 The invariant that each normative paragraph is associated with a line | 8259 The invariant that each normative paragraph is associated with a line |
8271 containing the text \LMHash{} should be maintained. Extra occurrences | 8260 containing the text \LMHash{} should be maintained. Extra occurrences |
8272 of \LMHash{} can be added if needed, e.g., in order to make | 8261 of \LMHash{} can be added if needed, e.g., in order to make |
8273 individual \item{}s in itemized lists addressable. Each \LM.. command | 8262 individual \item{}s in itemized lists addressable. Each \LM.. command |
8274 must occur on a separate line. \LMHash{} must occur immediately | 8263 must occur on a separate line. \LMHash{} must occur immediately |
8275 before the associated paragraph, and \LMLabel must occur immediately | 8264 before the associated paragraph, and \LMLabel must occur immediately |
8276 after the associated \section{}, \subsection{} etc. | 8265 after the associated \section{}, \subsection{} etc. |
8277 | 8266 |
8278 ---------------------------------------------------------------------- | 8267 ---------------------------------------------------------------------- |
OLD | NEW |