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 \newcommand{\code}[1]{{\sf #1}} | 8 \newcommand{\code}[1]{{\sf #1}} |
9 \title{Dart Programming Language Specification\\ | 9 \title{Dart Programming Language Specification \\ |
10 {\large Version 1.10}} | 10 (4th edition draft)\\ |
| 11 {\large Version 1.11}} |
11 | 12 |
12 % For information about Location Markers (and in particular the | 13 % For information about Location Markers (and in particular the |
13 % commands \LMHash and \LMLabel), see the long comment at the | 14 % commands \LMHash and \LMLabel), see the long comment at the |
14 % end of this file. | 15 % end of this file. |
15 | 16 |
16 \begin{document} | 17 \begin{document} |
17 \maketitle | 18 \maketitle |
18 \tableofcontents | 19 \tableofcontents |
19 | 20 |
20 | 21 |
(...skipping 1823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1844 \begin{grammar} | 1845 \begin{grammar} |
1845 {\bf interfaces:} | 1846 {\bf interfaces:} |
1846 \IMPLEMENTS{} typeList | 1847 \IMPLEMENTS{} typeList |
1847 . | 1848 . |
1848 \end{grammar} | 1849 \end{grammar} |
1849 | 1850 |
1850 \LMHash{} | 1851 \LMHash{} |
1851 The scope of the \IMPLEMENTS{} clause of a class $C$ is the type-parameter scope
of $C$. | 1852 The scope of the \IMPLEMENTS{} clause of a class $C$ is the type-parameter scope
of $C$. |
1852 | 1853 |
1853 \LMHash{} | 1854 \LMHash{} |
1854 It is a compile-time error if the \IMPLEMENTS{} clause of a class $C$ specifie
s a type variable as a superinterface. It is a compile-time error if the \IMPL
EMENTS{} clause of a class $C$ specifies an enumerated type (\ref{enums}), a ma
lformed type or deferred type (\ref{staticTypes}) as a superinterface It is a c
ompile-time error if the \IMPLEMENTS{} clause of a class $C$ specifies type \DYN
AMIC{} as a superinterface. It is a compile-time error if the \IMPLEMENTS{} cl
ause of a class $C$ specifies a type $T$ as a superinterface more than once. | 1855 It is a compile-time error if the \IMPLEMENTS{} clause of a class $C$ specifie
s a type variable as a superinterface. It is a compile-time error if the \IMPL
EMENTS{} clause of a class $C$ specifies an enumerated type (\ref{enums}), a ma
lformed type or deferred type (\ref{staticTypes}) as a superinterface. It is a
compile-time error if the \IMPLEMENTS{} clause of a class $C$ specifies type \DY
NAMIC{} as a superinterface. It is a compile-time error if the \IMPLEMENTS{} c
lause of a class $C$ specifies a type $T$ as a superinterface more than once. |
1855 It is a compile-time error if the superclass of a class $C$ is specified as a su
perinterface of $C$. | 1856 It is a compile-time error if the superclass of a class $C$ is specified as a su
perinterface of $C$. |
1856 | 1857 |
1857 \rationale{ | 1858 \rationale{ |
1858 One might argue that it is harmless to repeat a type in the superinterface list,
so why make it an error? The issue is not so much that the situation described
in program source is erroneous, but that it is pointless. As such, it is an indi
cation that the programmer may very well have meant to say something else - and
that is a mistake that should be called to her or his attention. Nevertheless,
we could simply issue a warning; and perhaps we should and will. That said, prob
lems like these are local and easily corrected on the spot, so we feel justified
in taking a harder line. | 1859 One might argue that it is harmless to repeat a type in the superinterface list,
so why make it an error? The issue is not so much that the situation described
in program source is erroneous, but that it is pointless. As such, it is an indi
cation that the programmer may very well have meant to say something else - and
that is a mistake that should be called to her or his attention. Nevertheless,
we could simply issue a warning; and perhaps we should and will. That said, prob
lems like these are local and easily corrected on the spot, so we feel justified
in taking a harder line. |
1859 } | 1860 } |
1860 | 1861 |
1861 \LMHash{} | 1862 \LMHash{} |
1862 It is a compile-time error if the interface of a class $C$ is a superinterface o
f itself. | 1863 It is a compile-time error if the interface of a class $C$ is a superinterface o
f itself. |
1863 | 1864 |
1864 \LMHash{} | 1865 \LMHash{} |
(...skipping 1922 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3787 | 3788 |
3788 \LMHash{} | 3789 \LMHash{} |
3789 $o?.m(a_1, \ldots , a_n, x_{n+1}: a_{n+1}, \ldots , x_{n+k}: a_{n+k})$ | 3790 $o?.m(a_1, \ldots , a_n, x_{n+1}: a_{n+1}, \ldots , x_{n+k}: a_{n+k})$ |
3790 | 3791 |
3791 \LMHash{} | 3792 \LMHash{} |
3792 is equivalent to the evaluation of the expression | 3793 is equivalent to the evaluation of the expression |
3793 | 3794 |
3794 \LMHash{} | 3795 \LMHash{} |
3795 $((x) => x == \NULL ? \NULL : x.m(a_1, \ldots , a_n, x_{n+1}: a_{n+1}, \ldots ,
x_{n+k}: a_{n+k}))(o)$. | 3796 $((x) => x == \NULL ? \NULL : x.m(a_1, \ldots , a_n, x_{n+1}: a_{n+1}, \ldots ,
x_{n+k}: a_{n+k}))(o)$. |
3796 | 3797 |
| 3798 unless $o$ is a type literal, in which case it is equivalent to $o.m(a_1, \ldot
s , a_n, x_{n+1}: a_{n+1}, \ldots , x_{n+k}: a_{n+k})$. |
| 3799 |
3797 \LMHash{} | 3800 \LMHash{} |
3798 The static type of $e$ is the same as the static type of $o.m(a_1, \ldots , a_n,
x_{n+1}: a_{n+1}, \ldots , x_{n+k}: a_{n+k})$. Exactly the same static warnings
that would be caused by $o.m(a_1, \ldots , a_n, x_{n+1}: a_{n+1}, \ldots , x_{n
+k}: a_{n+k})$ are also generated in the case of $o?.m(a_1, \ldots , a_n, x_{n+1
}: a_{n+1}, \ldots , x_{n+k}: a_{n+k})$. | 3801 The static type of $e$ is the same as the static type of $o.m(a_1, \ldots , a_n,
x_{n+1}: a_{n+1}, \ldots , x_{n+k}: a_{n+k})$. Exactly the same static warnings
that would be caused by $o.m(a_1, \ldots , a_n, x_{n+1}: a_{n+1}, \ldots , x_{n
+k}: a_{n+k})$ are also generated in the case of $o?.m(a_1, \ldots , a_n, x_{n+1
}: a_{n+1}, \ldots , x_{n+k}: a_{n+k})$. |
3799 | 3802 |
3800 \LMHash{} | 3803 \LMHash{} |
3801 An {\em unconditional ordinary method invocation} $i$ has the form | 3804 An {\em unconditional ordinary method invocation} $i$ has the form |
3802 | 3805 |
3803 $o.m(a_1, \ldots , a_n, x_{n+1}: a_{n+1}, \ldots , x_{n+k}: a_{n+k})$. | 3806 $o.m(a_1, \ldots , a_n, x_{n+1}: a_{n+1}, \ldots , x_{n+k}: a_{n+k})$. |
3804 | 3807 |
3805 \LMHash{} | 3808 \LMHash{} |
3806 Evaluation of an unconditional ordinary method invocation $i$ of the form | 3809 Evaluation of an unconditional ordinary method invocation $i$ of the form |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3863 \end{code} | 3866 \end{code} |
3864 | 3867 |
3865 \commentary{Notice that the wording carefully avoids re-evaluating the receiver
$o$ and the arguments $a_i$. } | 3868 \commentary{Notice that the wording carefully avoids re-evaluating the receiver
$o$ and the arguments $a_i$. } |
3866 | 3869 |
3867 \LMHash{} | 3870 \LMHash{} |
3868 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: | 3871 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: |
3869 \begin{itemize} | 3872 \begin{itemize} |
3870 \item | 3873 \item |
3871 $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 | 3874 $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 |
3872 \item $T$ is \code{Type}, $e$ is a constant type literal and the class correspo
nding to $e$ has a static getter named $m$. | 3875 \item $T$ is \code{Type}, $e$ is a constant type literal and the class correspo
nding to $e$ has a static getter named $m$. |
3873 \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 issue if this is not the case. Furtherm
ore, any use of \CALL on a subclass of \code{Function} that fails to implement \
CALL{} will also provoke a a warning, as this exemption is limited to type \code
{Function}, and does not apply to its subtypes. | 3876 \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 issue if this is not the case. Furtherm
ore, any use of \CALL{} on a subclass of \code{Function} that fails to implement
\CALL{} will also provoke a a warning, as this exemption is limited to type \co
de{Function}, and does not apply to its subtypes. |
3874 } | 3877 } |
3875 \end{itemize} | 3878 \end{itemize} |
3876 | 3879 |
3877 \LMHash{} | 3880 \LMHash{} |
3878 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$. | 3881 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$. |
3879 | 3882 |
3880 \LMHash{} | 3883 \LMHash{} |
3881 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 `.'. | 3884 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 `.'. |
3882 | 3885 |
3883 | 3886 |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3986 | 3989 |
3987 | 3990 |
3988 \commentary{Closures derived from members via closurization are colloquially kno
wn as tear-offs} | 3991 \commentary{Closures derived from members via closurization are colloquially kno
wn as tear-offs} |
3989 | 3992 |
3990 Property extraction can be either {\em conditional} or {\em unconditional}. | 3993 Property extraction can be either {\em conditional} or {\em unconditional}. |
3991 | 3994 |
3992 \rationale { | 3995 \rationale { |
3993 Tear-offs using the \cd{ x\#id} syntax cannot be conditional at this time; this
is inconsistent, and is likely to be addressed in the near future, perhaps via
notation such as \cd{ x?\#id} . As indicated in section \ref{ecmaConformance},
experimentation in this area is allowed. | 3996 Tear-offs using the \cd{ x\#id} syntax cannot be conditional at this time; this
is inconsistent, and is likely to be addressed in the near future, perhaps via
notation such as \cd{ x?\#id} . As indicated in section \ref{ecmaConformance},
experimentation in this area is allowed. |
3994 } | 3997 } |
3995 | 3998 |
3996 Evaluation of a {\em conditional property extraction expression} $e$ of the form
$e_1?.id$ is equivalent to the evaluation of the expression $((x) => x == \NU
LL ? \NULL : x.id)(e_1)$. The static type of $e$ is the same as the static type
of $e_1.id$. Let $T$ be the static type of $e_1$ and let $y$ be a fresh variable
of type $T$. Exactly the same static warnings that would be caused by $y.id$ ar
e also generated in the case of $e_1?.id$. | 3999 Evaluation of a {\em conditional property extraction expression} $e$ of the form
$e_1?.id$ is equivalent to the evaluation of the expression $((x) => x == \NU
LL ? \NULL : x.id)(e_1)$. |
| 4000 unless $e_1$ is a type literal, in which case it is equivalent to $e_1.m$. |
3997 | 4001 |
3998 \commentary{ | 4002 The static type of $e$ is the same as the static type of $e_1.id$. Let $T$ be th
e static type of $e_1$ and let $y$ be a fresh variable of type $T$. Exactly the
same static warnings that would be caused by $y.id$ are also generated in the ca
se of $e_1?.id$. |
3999 One might be tempted to conclude that for $e \ne \NULL{}$, $e?.v$ is always equi
valent to $e.v$. However this is not the case. If $e$ is a type literal represen
ting a type with static member $v$, then $e.v$ refers to that member, but $e?.v$
does not. | |
4000 } | |
4001 | 4003 |
4002 \LMHash{} | 4004 \LMHash{} |
4003 Unconditional property extraction takes several syntactic forms: $e.m$ (\ref{get
terAccessAndMethodExtraction}), $\SUPER.m$ (\ref{superGetterAccessAndMethodClosu
rization}), $e\#m$ (\ref{generalClosurization}), $\NEW{}$ $T\#m$ (\ref{namedCons
tructorExtraction}), $\NEW{}$ $T\#$ (\ref{anonymousConstructorExtraction}) and $
\SUPER\#m$ (\ref{generalSuperPropertyExtraction}), where $e$ is an expression, $
m$ is an identifier optionally followed by an equal sign and $T$ is a type. | 4005 Unconditional property extraction takes several syntactic forms: $e.m$ (\ref{get
terAccessAndMethodExtraction}), $\SUPER.m$ (\ref{superGetterAccessAndMethodClosu
rization}), $e\#m$ (\ref{generalClosurization}), $\NEW{}$ $T\#m$ (\ref{namedCons
tructorExtraction}), $\NEW{}$ $T\#$ (\ref{anonymousConstructorExtraction}) and $
\SUPER\#m$ (\ref{generalSuperPropertyExtraction}), where $e$ is an expression, $
m$ is an identifier optionally followed by an equal sign and $T$ is a type. |
4004 | 4006 |
4005 \subsubsection{Getter Access and Method Extraction} | 4007 \subsubsection{Getter Access and Method Extraction} |
4006 \LMLabel{getterAccessAndMethodExtraction} | 4008 \LMLabel{getterAccessAndMethodExtraction} |
4007 | 4009 |
4008 \LMHash{} | 4010 \LMHash{} |
4009 Evaluation of a property extraction $i$ of the form $e.m$ proceeds as follows: | 4011 Evaluation of a property extraction $i$ of the form $e.m$ proceeds as follows: |
4010 | 4012 |
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4427 \LMHash{} | 4429 \LMHash{} |
4428 Otherwise, the assignment is equivalent to the assignment \code{ \THIS{}.$v$ = $
e$}. | 4430 Otherwise, the assignment is equivalent to the assignment \code{ \THIS{}.$v$ = $
e$}. |
4429 | 4431 |
4430 \LMHash{} | 4432 \LMHash{} |
4431 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 (\ref{actualTypeOfAD
eclaration}) of $v$. | 4433 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 (\ref{actualTypeOfAD
eclaration}) of $v$. |
4432 | 4434 |
4433 \LMHash{} | 4435 \LMHash{} |
4434 It is a static type warning if the static type of $e$ may not be assigned to the
static type of $v$. The static type of the expression $v$ \code{=} $e$ is the s
tatic type of $e$. | 4436 It is a static type warning if the static type of $e$ may not be assigned to the
static type of $v$. The static type of the expression $v$ \code{=} $e$ is the s
tatic type of $e$. |
4435 | 4437 |
4436 \LMHash{} | 4438 \LMHash{} |
4437 Evaluation of an assignment $a$ of the form $e_1?.v$ \code{=} $e_2$ is equivalen
t to the evaluation of the expression $((x) => x == \NULL? \NULL: x.v = e_2)(e_1
)$. The static type of $a$ is the static type of $e_2$. Let $T$ be the static ty
pe of $e_1$ and let $y$ be a fresh variable of type $T$. Exactly the same static
warnings that would be caused by $y.v = e_2$ are also generated in the case of
$e_1?.v$ \code{=} $e_2$. | 4439 Evaluation of an assignment $a$ of the form $e_1?.v$ \code{=} $e_2$ is equivalen
t to the evaluation of the expression $((x) => x == \NULL? \NULL: x.v = e_2)(e_1
)$ |
| 4440 unless $e_1$ is a type literal, in which case it is equivalent to $e_1.v$ \cod
e{=} $e_2$. |
| 4441 . The static type of $a$ is the static type of $e_2$. Let $T$ be the static type
of $e_1$ and let $y$ be a fresh variable of type $T$. Exactly the same static w
arnings that would be caused by $y.v = e_2$ are also generated in the case of $e
_1?.v$ \code{=} $e_2$. |
4438 | 4442 |
4439 \LMHash{} | 4443 \LMHash{} |
4440 Evaluation of an assignment of the form $e_1.v$ \code{=} $e_2$ proceeds as follo
ws: | 4444 Evaluation of an assignment of the form $e_1.v$ \code{=} $e_2$ proceeds as follo
ws: |
4441 | 4445 |
4442 \LMHash{} | 4446 \LMHash{} |
4443 The expression $e_1$ is evaluated to an object $o_1$. Then, the expression $e_2$
is evaluated to an object $o_2$. Then, the setter $v=$ is looked up (\ref{gett
erAndSetterLookup}) in $o_1$ with respect to the current library. If $o_1$ is a
n instance of \code{Type} but $e_1$ is not a constant type literal, then if $v=$
is a setter that forwards (\ref{functionDeclarations}) to a static setter, sett
er lookup fails. Otherwise, the body of $v=$ is executed with its formal parame
ter bound to $o_2$ and \THIS{} bound to $o_1$. | 4447 The expression $e_1$ is evaluated to an object $o_1$. Then, the expression $e_2$
is evaluated to an object $o_2$. Then, the setter $v=$ is looked up (\ref{gett
erAndSetterLookup}) in $o_1$ with respect to the current library. If $o_1$ is a
n instance of \code{Type} but $e_1$ is not a constant type literal, then if $v=$
is a setter that forwards (\ref{functionDeclarations}) to a static setter, sett
er lookup fails. Otherwise, the body of $v=$ is executed with its formal parame
ter bound to $o_2$ and \THIS{} bound to $o_1$. |
4444 | 4448 |
4445 \LMHash{} | 4449 \LMHash{} |
4446 If the setter lookup has failed, then a new instance $im$ of the predefined cla
ss \code{Invocation} is created, such that : | 4450 If the setter lookup has failed, then a new instance $im$ of the predefined cla
ss \code{Invocation} is created, such that : |
4447 \begin{itemize} | 4451 \begin{itemize} |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4536 | 4540 |
4537 \LMHash{} | 4541 \LMHash{} |
4538 It is a compile-time error to invoke any of the setters of class \cd{Object} on
a prefix object (\ref{imports}) or on a constant type literal that is immediate
ly followed by the token `.'. | 4542 It is a compile-time error to invoke any of the setters of class \cd{Object} on
a prefix object (\ref{imports}) or on a constant type literal that is immediate
ly followed by the token `.'. |
4539 | 4543 |
4540 | 4544 |
4541 | 4545 |
4542 \subsubsection{Compound Assignment} | 4546 \subsubsection{Compound Assignment} |
4543 \LMLabel{compoundAssignment} | 4547 \LMLabel{compoundAssignment} |
4544 | 4548 |
4545 \LMHash{} | 4549 \LMHash{} |
4546 Evaluation of a compound assignment of the form $v$ {\em ??=} $e$ is equivalent
to the evaluation of the expression $((x) => x == \NULL{}$ ? $v=e : x)(v)$ whe
re $x$ is a fresh variable that is not used in $e$. Evaluation of a compound ass
ignment of the form $C.v$ {\em ??=} $e$, where $C$ is a type literal, is equival
ent to the evaluation of the expression $((x) => x == \NULL{}$? $C.v=e: x)(C.v
)$ where $x$ is a fresh variable that is not used in $e$. | 4550 Evaluation of a compound assignment of the form $v$ {\em ??=} $e$ is equivalent
to the evaluation of the expression $((x) => x == \NULL{}$ ? $v=e : x)(v)$ whe
re $x$ is a fresh variable that is not used in $e$. |
| 4551 |
| 4552 \LMHash{} |
| 4553 Evaluation of a compound assignment of the form $C.v$ {\em ??=} $e$, where $C$ i
s a type literal, is equivalent to the evaluation of the expression $((x) => x
== \NULL{}$? $C.v=e: x)(C.v)$ where $x$ is a fresh variable that is not used in
$e$. |
4547 | 4554 |
4548 \commentary { | 4555 \commentary { |
4549 The two rules above also apply when the variable v or the type C is prefixed. | 4556 The two rules above also apply when the variable v or the type C is prefixed. |
4550 } | 4557 } |
4551 | 4558 |
4552 Evaluation of a compound assignment of the form $e_1.v$ {\em ??=} $e_2$ is equiv
alent to the evaluation of the expression $((x) =>((y) => y == \NULL{}$ ? $ x.v
= e_2: y)(x.v))(e_1)$ where $x$ and $y$ are distinct fresh variables that are n
ot used in $e_2$. Evaluation of a compound assignment of the form $e_1[e_2]$ {
\em ??=} $e_3$ is equivalent to the evaluation of the expression | 4559 \LMHash{} |
4553 $((a, i) => ((x) => x == \NULL{}$ ? $a[i] = e_3: x)(a[i]))(e_1, e_2)$ where $x$
, $a$ and $i$ are distinct fresh variables that are not used in $e_3$. Evaluatio
n of a compound assignment of the form $\SUPER.v$ {\em ??=} $e$ is equivalent t
o the evaluation of the expression $((x) => x == \NULL{}$ ? $\SUPER.v = e: x)(\
SUPER.v)$ where $x$ is a fresh variable that is not used in $e$. | 4560 Evaluation of a compound assignment of the form $e_1.v$ {\em ??=} $e_2$ is equiv
alent to the evaluation of the expression $((x) =>((y) => y == \NULL{}$ ? $ x.v
= e_2: y)(x.v))(e_1)$ where $x$ and $y$ are distinct fresh variables that are n
ot used in $e_2$. |
| 4561 |
| 4562 \LMHash{} |
| 4563 Evaluation of a compound assignment of the form $e_1[e_2]$ {\em ??=} $e_3$ is
equivalent to the evaluation of the expression |
| 4564 $((a, i) => ((x) => x == \NULL{}$ ? $a[i] = e_3: x)(a[i]))(e_1, e_2)$ where $x$
, $a$ and $i$ are distinct fresh variables that are not used in $e_3$. |
| 4565 |
| 4566 \LMHash{} |
| 4567 Evaluation of a compound assignment of the form $\SUPER.v$ {\em ??=} $e$ is equ
ivalent to the evaluation of the expression $((x) => x == \NULL{}$ ? $\SUPER.v
= e: x)(\SUPER.v)$ where $x$ is a fresh variable that is not used in $e$. |
4554 | 4568 |
4555 \LMHash{} | 4569 \LMHash{} |
4556 Evaluation of a compound assignment of the form $e_1?.v$ {\em ??=} $e_2$ is equ
ivalent to the evaluation of the expression \code{((x) $=>$ x == \NULL{} ? \NUL
L: $x.v ??= e_2$)($e_1$)} where $x$ is a variable that is not used in $e_2$. | 4570 Evaluation of a compound assignment of the form $e_1?.v$ {\em ??=} $e_2$ is equ
ivalent to the evaluation of the expression \code{((x) $=>$ x == \NULL{} ? \NUL
L: $x.v ??= e_2$)($e_1$)} where $x$ is a variable that is not used in $e_2$. |
| 4571 % But what about C?.v ??= e |
4557 | 4572 |
| 4573 \LMHash{} |
| 4574 A compound assignment of the form $C?.v$ {\em ??=} $e_2$ is equivalent to the e
xpression $C.v$ {\em ??=} $e$. |
4558 | 4575 |
4559 \LMHash{} | 4576 \LMHash{} |
4560 The static type of a compound assignment of the form $v$ {\em ??=} $e$ is the le
ast upper bound of the static type of $v$ and the static type of $e$. Exactly t
he same static warnings that would be caused by $v = e$ are also generated in th
e case of $v$ {\em ??=} $e$. | 4577 The static type of a compound assignment of the form $v$ {\em ??=} $e$ is the le
ast upper bound of the static type of $v$ and the static type of $e$. Exactly t
he same static warnings that would be caused by $v = e$ are also generated in th
e case of $v$ {\em ??=} $e$. |
4561 | 4578 |
4562 | 4579 |
4563 \LMHash{} | 4580 \LMHash{} |
4564 The static type of a compound assignment of the form $C.v$ {\em ??=} $e$ is th
e least upper bound of the static type of $C.v$ and the static type of $e$. Exa
ctly the same static warnings that would be caused by $C.v = e$ are also generat
ed in the case of $C.v$ {\em ??=} $e$. | 4581 The static type of a compound assignment of the form $C.v$ {\em ??=} $e$ is th
e least upper bound of the static type of $C.v$ and the static type of $e$. Exa
ctly the same static warnings that would be caused by $C.v = e$ are also generat
ed in the case of $C.v$ {\em ??=} $e$. |
4565 | 4582 |
4566 \LMHash{} | 4583 \LMHash{} |
4567 The static type of a compound assignment of the form $e_1.v$ {\em ??=} $e_2$ is
the least upper bound of the static type of $e_1.v$ and the static type of $e_2
$. Let $T$ be the static type of $e_1$ and let $z$ be a fresh variable of type $
T$. Exactly the same static warnings that would be caused by $z.v = e_2$ are als
o generated in the case of $e_1.v$ {\em ??=} $e_2$. | 4584 The static type of a compound assignment of the form $e_1.v$ {\em ??=} $e_2$ is
the least upper bound of the static type of $e_1.v$ and the static type of $e_2
$. Let $T$ be the static type of $e_1$ and let $z$ be a fresh variable of type $
T$. Exactly the same static warnings that would be caused by $z.v = e_2$ are als
o generated in the case of $e_1.v$ {\em ??=} $e_2$. |
4568 | 4585 |
4569 \LMHash{} | 4586 \LMHash{} |
4570 The static type of a compound assignment of the form $e_1[e_2]$ {\em ??=} $e_3$
is the least upper bound of the static type of $e_1[e_2]$ and the static type
of $e_3$. Exactly the same static warnings that would be caused by $e_1[e_2] = e
_3$ are also generated in the case of $e_1[e_2]$ {\em ??=} $e_3$. | 4587 The static type of a compound assignment of the form $e_1[e_2]$ {\em ??=} $e_3$
is the least upper bound of the static type of $e_1[e_2]$ and the static type
of $e_3$. Exactly the same static warnings that would be caused by $e_1[e_2] = e
_3$ are also generated in the case of $e_1[e_2]$ {\em ??=} $e_3$. |
4571 | 4588 |
4572 \LMHash{} | 4589 \LMHash{} |
4573 The static type of a compound assignment of the form $\SUPER.v$ {\em ??=} $e$
is the least upper bound of the static type of $\SUPER.v$ and the static type of
$e$. Exactly the same static warnings that would be caused by $\SUPER.v = e$ ar
e also generated in the case of $\SUPER.v$ {\em ??=} $e$. | 4590 The static type of a compound assignment of the form $\SUPER.v$ {\em ??=} $e$
is the least upper bound of the static type of $\SUPER.v$ and the static type of
$e$. Exactly the same static warnings that would be caused by $\SUPER.v = e$ ar
e also generated in the case of $\SUPER.v$ {\em ??=} $e$. |
4574 | 4591 |
4575 \LMHash{} | 4592 \LMHash{} |
4576 For any other valid operator $op$, a compound assignment of the form $v$ $op\cod
e{=} e$ is equivalent to $v \code{=} v$ $op$ $e$. A compound assignment of the f
orm $C.v$ $op \code{=} e$ is equivalent to $C.v \code{=} C.v$ $op$ $e$. A compou
nd assignment of the form $e_1.v$ $op = e_2$ is equivalent to \code{((x) $=>$ x.
v = x.v $op$ $e_2$)($e_1$)} where $x$ is a variable that is not used in $e_2$. A
compound assignment of the form $e_1[e_2]$ $op\code{=} e_3$ is equivalent to | 4593 For any other valid operator $op$, a compound assignment of the form $v$ $op\cod
e{=} e$ is equivalent to $v \code{=} v$ $op$ $e$. A compound assignment of the f
orm $C.v$ $op \code{=} e$ is equivalent to $C.v \code{=} C.v$ $op$ $e$. A compou
nd assignment of the form $e_1.v$ $op = e_2$ is equivalent to \code{((x) $=>$ x.
v = x.v $op$ $e_2$)($e_1$)} where $x$ is a variable that is not used in $e_2$. A
compound assignment of the form $e_1[e_2]$ $op\code{=} e_3$ is equivalent to |
4577 \code{((a, i) $=>$ a[i] = a[i] $op$ $e_3$)($e_1, e_2$)} where $a$ and $i$ are a
variables that are not used in $e_3$. | 4594 \code{((a, i) $=>$ a[i] = a[i] $op$ $e_3$)($e_1, e_2$)} where $a$ and $i$ are a
variables that are not used in $e_3$. |
4578 | 4595 |
4579 \LMHash{} | 4596 \LMHash{} |
4580 Evaluation of a compound assignment of the form $e_1?.v$ $op = e_2$ is equivalen
t to \code{((x) $=>$ x?.v = x.v $op$ $e_2$)($e_1$)} where $x$ is a variable that
is not used in $e_2$. The static type of $e_1?.v$ $op = e_2$ is the static type
of $e_1.v$ $op$ $e_2$. Exactly the same static warnings that would be caused by
$e_1.v$ $op = e_2$ are also generated in the case of $e_1?.v$ $op = e_2$. | 4597 Evaluation of a compound assignment of the form $e_1?.v$ $op = e_2$ is equivalen
t to \code{((x) $=>$ x?.v = x.v $op$ $e_2$)($e_1$)} where $x$ is a variable that
is not used in $e_2$. The static type of $e_1?.v$ $op = e_2$ is the static type
of $e_1.v$ $op$ $e_2$. Exactly the same static warnings that would be caused by
$e_1.v$ $op = e_2$ are also generated in the case of $e_1?.v$ $op = e_2$. |
4581 | 4598 |
4582 % Buggy. Allows C?.v = e. | 4599 \LMHash{} |
| 4600 A compound assignment of the form $C?.v$ $op = e_2$ is equivalent to the express
ion |
| 4601 $C.v$ $op = e_2$. |
4583 | 4602 |
4584 \begin{grammar} | 4603 \begin{grammar} |
4585 {\bf compoundAssignmentOperator:}`*='; | 4604 {\bf compoundAssignmentOperator:}`*='; |
4586 `/='; | 4605 `/='; |
4587 `\~{}/='; | 4606 `\~{}/='; |
4588 `\%='; | 4607 `\%='; |
4589 `+='; | 4608 `+='; |
4590 `-='; | 4609 `-='; |
4591 `{\escapegrammar \lt \lt}='; | 4610 `{\escapegrammar \lt \lt}='; |
4592 `{\escapegrammar \gt \gt}='; | 4611 `{\escapegrammar \gt \gt}='; |
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5081 Execution of a postfix expression of the form \code{$e_1[e_2]$-{}-}, is equival
ent to executing | 5100 Execution of a postfix expression of the form \code{$e_1[e_2]$-{}-}, is equival
ent to executing |
5082 | 5101 |
5083 \code{(a, i)\{\VAR{} r = a[i]; a[i] = r - 1; \RETURN{} r\}($e_1$, $e_2$)}. | 5102 \code{(a, i)\{\VAR{} r = a[i]; a[i] = r - 1; \RETURN{} r\}($e_1$, $e_2$)}. |
5084 | 5103 |
5085 \LMHash{} | 5104 \LMHash{} |
5086 The static type of such an expression is the static type of $e_1[e_2]$. | 5105 The static type of such an expression is the static type of $e_1[e_2]$. |
5087 | 5106 |
5088 \LMHash{} | 5107 \LMHash{} |
5089 Execution of a postfix expression of the form \code{$e_1?.v$++} is equivalent to
executing | 5108 Execution of a postfix expression of the form \code{$e_1?.v$++} is equivalent to
executing |
5090 | 5109 |
5091 \code{((x) =$>$ x == \NULL? \NULL : x.v++)($e_1$)}. | 5110 \code{((x) =$>$ x == \NULL? \NULL : x.v++)($e_1$)} |
| 5111 unless $e_1$ is a type literal, in which case it is equivalent to \code{$e_1.v$+
+} |
| 5112 . |
5092 | 5113 |
5093 \LMHash{} | 5114 \LMHash{} |
5094 The static type of such an expression is the static type of $e_1.v$. | 5115 The static type of such an expression is the static type of $e_1.v$. |
5095 | 5116 |
5096 \LMHash{} | 5117 \LMHash{} |
5097 Execution of a postfix expression of the form \code{$e_1?.v$-{}-} is equivalent
to executing | 5118 Execution of a postfix expression of the form \code{$e_1?.v$-{}-} is equivalent
to executing |
5098 | 5119 |
5099 \code{((x) =$>$ x == \NULL? \NULL : x.v-{}-)($e_1$)}. | 5120 \code{((x) =$>$ x == \NULL? \NULL : x.v-{}-)($e_1$)} |
| 5121 unless $e_1$ is a type literal, in which case it is equivalent to \code{$e_1.v$-
{}-} |
| 5122 . |
5100 | 5123 |
5101 \LMHash{} | 5124 \LMHash{} |
5102 The static type of such an expression is the static type of $e_1.v$. | 5125 The static type of such an expression is the static type of $e_1.v$. |
5103 | 5126 |
5104 | 5127 |
5105 \subsection{ Assignable Expressions} | 5128 \subsection{ Assignable Expressions} |
5106 \LMLabel{assignableExpressions} | 5129 \LMLabel{assignableExpressions} |
5107 | 5130 |
5108 \LMHash{} | 5131 \LMHash{} |
5109 Assignable expressions are expressions that can appear on the left hand side of
an assignment. | 5132 Assignable expressions are expressions that can appear on the left hand side of
an assignment. |
(...skipping 2731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7841 | 7864 |
7842 The invariant that each normative paragraph is associated with a line | 7865 The invariant that each normative paragraph is associated with a line |
7843 containing the text \LMHash{} should be maintained. Extra occurrences | 7866 containing the text \LMHash{} should be maintained. Extra occurrences |
7844 of \LMHash{} can be added if needed, e.g., in order to make | 7867 of \LMHash{} can be added if needed, e.g., in order to make |
7845 individual \item{}s in itemized lists addressable. Each \LM.. command | 7868 individual \item{}s in itemized lists addressable. Each \LM.. command |
7846 must occur on a separate line. \LMHash{} must occur immediately | 7869 must occur on a separate line. \LMHash{} must occur immediately |
7847 before the associated paragraph, and \LMLabel must occur immediately | 7870 before the associated paragraph, and \LMLabel must occur immediately |
7848 after the associated \section{}, \subsection{} etc. | 7871 after the associated \section{}, \subsection{} etc. |
7849 | 7872 |
7850 ---------------------------------------------------------------------- | 7873 ---------------------------------------------------------------------- |
OLD | NEW |