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 \\ |
(...skipping 2319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2330 %By current rules, this is illegal. Make sure we preserve this. | 2330 %By current rules, this is illegal. Make sure we preserve this. |
2331 | 2331 |
2332 | 2332 |
2333 %\subsection{Interface Injection} | 2333 %\subsection{Interface Injection} |
2334 %\LMLabel{interfaceInjection} | 2334 %\LMLabel{interfaceInjection} |
2335 | 2335 |
2336 %An {\em interface injection declaration} causes a pre-existing class $S$ to be
considered a subinterface of another interface $I$. It is a static type warning
if $S$ is not a structural subtype of $I$. However, the subinterface relations i
mplied by the interface injection declaration are considered to hold by both the
typechecker and the runtime, regardless. | 2336 %An {\em interface injection declaration} causes a pre-existing class $S$ to be
considered a subinterface of another interface $I$. It is a static type warning
if $S$ is not a structural subtype of $I$. However, the subinterface relations i
mplied by the interface injection declaration are considered to hold by both the
typechecker and the runtime, regardless. |
2337 | 2337 |
2338 %\begin{grammar} | 2338 %\begin{grammar} |
2339 %classInterfaceInjection: | 2339 %classInterfaceInjection: |
2340 %class qualified typeParameters? interfaces '{\escapegrammar ;}' | 2340 %class qualified typeParameters? interfaces `{\escapegrammar ;}' |
2341 % . | 2341 % . |
2342 | 2342 |
2343 | 2343 |
2344 %interfaceInterfaceInjection: | 2344 %interfaceInterfaceInjection: |
2345 %interface qualified typeParameters? superinterfaces '{\escapegrammar ;}' | 2345 %interface qualified typeParameters? superinterfaces `{\escapegrammar ;}' |
2346 %. | 2346 %. |
2347 %\end{grammar} | 2347 %\end{grammar} |
2348 | 2348 |
2349 %\rationale{Since subinterface relations can be tested dynamically via \IS{}, in
terface injection is not just a directive to the static checker. The dynamic rel
ations implied must hold regardless of whether a static typecheck has succeeded
, or has been performed at all. This makes sense from the perspective of preserv
ing programmer intent. The injection describes a nominal type relation that the
programmer wishes to hold. Just as a supertype mentioned within a class declarat
ion is considered a supertype even though type errors might arise among (say) ov
erridden and overriding methods, so it must be that the relation implied by an i
njection holds regardless of type errors. | 2349 %\rationale{Since subinterface relations can be tested dynamically via \IS{}, in
terface injection is not just a directive to the static checker. The dynamic rel
ations implied must hold regardless of whether a static typecheck has succeeded
, or has been performed at all. This makes sense from the perspective of preserv
ing programmer intent. The injection describes a nominal type relation that the
programmer wishes to hold. Just as a supertype mentioned within a class declarat
ion is considered a supertype even though type errors might arise among (say) ov
erridden and overriding methods, so it must be that the relation implied by an i
njection holds regardless of type errors. |
2350 %In addition, this decision helps to produce meaningful and localized error mess
ages. Any errors are reported at the point of injection rather than at program p
oints that rely on the relation (a well known problem with structural subtyping
in OO systems). | 2350 %In addition, this decision helps to produce meaningful and localized error mess
ages. Any errors are reported at the point of injection rather than at program p
oints that rely on the relation (a well known problem with structural subtyping
in OO systems). |
2351 %} | 2351 %} |
2352 | 2352 |
2353 %\Q{When does an interface injection take effect? When the containing library is
loaded? | 2353 %\Q{When does an interface injection take effect? When the containing library is
loaded? |
2354 %What is the scope of such a declaration? Is it global, or only in the scope of
the containing library? The scope of such a declaration is global. | 2354 %What is the scope of such a declaration? Is it global, or only in the scope of
the containing library? The scope of such a declaration is global. |
2355 %An injection must be at top level. Who has the right to inject an interface $I$
into another class $C$? Anybody? But since this affects dynamic behavior, is th
is a weird security issue? | 2355 %An injection must be at top level. Who has the right to inject an interface $I$
into another class $C$? Anybody? But since this affects dynamic behavior, is th
is a weird security issue? |
(...skipping 3247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5603 | 5603 |
5604 \subsection{Local Variable Declaration} | 5604 \subsection{Local Variable Declaration} |
5605 \LMLabel{localVariableDeclaration} | 5605 \LMLabel{localVariableDeclaration} |
5606 | 5606 |
5607 | 5607 |
5608 \LMHash{} | 5608 \LMHash{} |
5609 A {\em variable declaration statement }declares a new local variable. | 5609 A {\em variable declaration statement }declares a new local variable. |
5610 | 5610 |
5611 \begin{grammar} | 5611 \begin{grammar} |
5612 {\bf localVariableDeclaration:} | 5612 {\bf localVariableDeclaration:} |
5613 initializedVariableDeclaration {\escapegrammar';'} | 5613 initializedVariableDeclaration `{\escapegrammar ;}' |
5614 . | 5614 . |
5615 \end{grammar} | 5615 \end{grammar} |
5616 | 5616 |
5617 \LMHash{} | 5617 \LMHash{} |
5618 Executing a variable declaration statement of one of the forms \VAR{} $v = e;$
, $T$ $v = e; $, \CONST{} $v = e;$, \CONST{} $T$ $v = e;$, \FINAL{} $v = e;$ o
r \FINAL{} $T$ $v = e;$ proceeds as follows: | 5618 Executing a variable declaration statement of one of the forms \VAR{} $v = e;$
, $T$ $v = e; $, \CONST{} $v = e;$, \CONST{} $T$ $v = e;$, \FINAL{} $v = e;$ o
r \FINAL{} $T$ $v = e;$ proceeds as follows: |
5619 | 5619 |
5620 \LMHash{} | 5620 \LMHash{} |
5621 The expression $e$ is evaluated to an object $o$. Then, the variable $v$ is set
to $o$. | 5621 The expression $e$ is evaluated to an object $o$. Then, the variable $v$ is set
to $o$. |
5622 | 5622 |
5623 \LMHash{} | 5623 \LMHash{} |
(...skipping 1727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7351 | 7351 |
7352 {\bf typeAlias:} | 7352 {\bf typeAlias:} |
7353 metadata \TYPEDEF{} typeAliasBody | 7353 metadata \TYPEDEF{} typeAliasBody |
7354 . | 7354 . |
7355 | 7355 |
7356 {\bf typeAliasBody:} | 7356 {\bf typeAliasBody:} |
7357 functionTypeAlias | 7357 functionTypeAlias |
7358 . | 7358 . |
7359 | 7359 |
7360 {\bf functionTypeAlias:} | 7360 {\bf functionTypeAlias:} |
7361 functionPrefix typeParameters? formalParameterList '{\escapegrammar ;}' | 7361 functionPrefix typeParameters? formalParameterList `{\escapegrammar ;}' |
7362 . | 7362 . |
7363 | 7363 |
7364 {\bf functionPrefix:} | 7364 {\bf functionPrefix:} |
7365 returnType? identifier | 7365 returnType? identifier |
7366 . | 7366 . |
7367 | 7367 |
7368 \end{grammar} | 7368 \end{grammar} |
7369 | 7369 |
7370 \LMHash{} | 7370 \LMHash{} |
7371 The effect of a type alias of the form \code{\TYPEDEF{} $T$ $id (T_1$ $p_1, \l
dots, T_n$ $p_n, [T_{n+1}$ $p_{n+1}, \ldots, T_{n+k}$ $p_{n+k}])$} declared in a
library $L$ is is to introduce the name $id$ into the scope of $L$, bound to th
e function type $(T_1, \ldots, T_n, [T_{n+1}$ $p_{n+1}, \ldots, T_{n+k}$ $p_{n+k
}]) \rightarrow T$. The effect of a type alias of the form \code{\TYPEDEF{}
$T$ $id (T_1$ $p_1, \ldots, T_n$ $p_n, \{T_{n+1}$ $p_{n+1}, \ldots, T_{n+k}$ $p_
{n+k}\})$} declared in a library $L$ is is to introduce the name $id$ into the s
cope of $L$, bound to the function type $(T_1, \ldots, T_n, \{T_{n+1}$ $p_{n+1},
\ldots, T_{n+k}$ $p_{n+k}\}) \rightarrow T$. . In either case, iff no return t
ype is specified, it is taken to be \DYNAMIC{}. Likewise, if a type annotation i
s omitted on a formal parameter, it is taken to be \DYNAMIC{}. | 7371 The effect of a type alias of the form \code{\TYPEDEF{} $T$ $id (T_1$ $p_1, \l
dots, T_n$ $p_n, [T_{n+1}$ $p_{n+1}, \ldots, T_{n+k}$ $p_{n+k}])$} declared in a
library $L$ is is to introduce the name $id$ into the scope of $L$, bound to th
e function type $(T_1, \ldots, T_n, [T_{n+1}$ $p_{n+1}, \ldots, T_{n+k}$ $p_{n+k
}]) \rightarrow T$. The effect of a type alias of the form \code{\TYPEDEF{}
$T$ $id (T_1$ $p_1, \ldots, T_n$ $p_n, \{T_{n+1}$ $p_{n+1}, \ldots, T_{n+k}$ $p_
{n+k}\})$} declared in a library $L$ is is to introduce the name $id$ into the s
cope of $L$, bound to the function type $(T_1, \ldots, T_n, \{T_{n+1}$ $p_{n+1},
\ldots, T_{n+k}$ $p_{n+k}\}) \rightarrow T$. . In either case, iff no return t
ype is specified, it is taken to be \DYNAMIC{}. Likewise, if a type annotation i
s omitted on a formal parameter, it is taken to be \DYNAMIC{}. |
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8040 | 8040 |
8041 The invariant that each normative paragraph is associated with a line | 8041 The invariant that each normative paragraph is associated with a line |
8042 containing the text \LMHash{} should be maintained. Extra occurrences | 8042 containing the text \LMHash{} should be maintained. Extra occurrences |
8043 of \LMHash{} can be added if needed, e.g., in order to make | 8043 of \LMHash{} can be added if needed, e.g., in order to make |
8044 individual \item{}s in itemized lists addressable. Each \LM.. command | 8044 individual \item{}s in itemized lists addressable. Each \LM.. command |
8045 must occur on a separate line. \LMHash{} must occur immediately | 8045 must occur on a separate line. \LMHash{} must occur immediately |
8046 before the associated paragraph, and \LMLabel must occur immediately | 8046 before the associated paragraph, and \LMLabel must occur immediately |
8047 after the associated \section{}, \subsection{} etc. | 8047 after the associated \section{}, \subsection{} etc. |
8048 | 8048 |
8049 ---------------------------------------------------------------------- | 8049 ---------------------------------------------------------------------- |
OLD | NEW |