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 3575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3586 | 3586 |
3587 \LMHash{} | 3587 \LMHash{} |
3588 If $T$ is a parameterized type, it is a compile-time error if $T$ includes a typ
e variable among its type arguments. | 3588 If $T$ is a parameterized type, it is a compile-time error if $T$ includes a typ
e variable among its type arguments. |
3589 | 3589 |
3590 \LMHash{} | 3590 \LMHash{} |
3591 If $e$ is of the form \CONST{} $T.id(a_1, \ldots , a_n, x_{n+1}: a_{n+1}, \ldots
, x_{n+k}: a_{n+k})$ it is a compile-time error if $T.id$ is not the name of a
constant constructor declared by the type $T$. If $e$ is of the form \CONST{} $
T(a_1, \ldots , a_n, x_{n+1}: a_{n+1}, \ldots , x_{n+k}: a_{n+k})$ it is a compi
le-time error if the type $T$ does not declare a constant constructor with the s
ame name as the declaration of $T$. | 3591 If $e$ is of the form \CONST{} $T.id(a_1, \ldots , a_n, x_{n+1}: a_{n+1}, \ldots
, x_{n+k}: a_{n+k})$ it is a compile-time error if $T.id$ is not the name of a
constant constructor declared by the type $T$. If $e$ is of the form \CONST{} $
T(a_1, \ldots , a_n, x_{n+1}: a_{n+1}, \ldots , x_{n+k}: a_{n+k})$ it is a compi
le-time error if the type $T$ does not declare a constant constructor with the s
ame name as the declaration of $T$. |
3592 | 3592 |
3593 \LMHash{} | 3593 \LMHash{} |
3594 In all of the above cases, it is a compile-time error if $a_i, i\in 1 .. n + k$
, is not a compile-time constant expression. | 3594 In all of the above cases, it is a compile-time error if $a_i, i\in 1 .. n + k$
, is not a compile-time constant expression. |
3595 | 3595 |
3596 %If $T$ is a parameterized type (\ref{parameterizedTypes}) $S<U_1, \ldots, U_m>
$, let $R = S$. It is a compile-time error if $T$ is is malformed. If $T$ is no
t a parameterized type, let $R = T$. | 3596 %If $T$ is a parameterized type (\ref{parameterizedTypes}) $S<U_1, \ldots, U_m>
$, let $R = S$. It is a compile-time error if $T$ is malformed. If $T$ is not a
parameterized type, let $R = T$. |
3597 %Finally, | 3597 %Finally, |
3598 % If $T$ is a generic with $l$ retype parameters, then for all $ i \in 1 .. l$,
let $V_i = \DYNAMIC{}$. | 3598 % If $T$ is a generic with $l$ retype parameters, then for all $ i \in 1 .. l$,
let $V_i = \DYNAMIC{}$. |
3599 | 3599 |
3600 \LMHash{} | 3600 \LMHash{} |
3601 Evaluation of $e$ proceeds as follows: | 3601 Evaluation of $e$ proceeds as follows: |
3602 | 3602 |
3603 \LMHash{} | 3603 \LMHash{} |
3604 First, if $e$ is of the form | 3604 First, if $e$ is of the form |
3605 | 3605 |
3606 \CONST{} $T.id(a_1, \ldots , a_n, x_{n+1}: a_{n+1}, \ldots , x_{n+k}: a_{n+k})$ | 3606 \CONST{} $T.id(a_1, \ldots , a_n, x_{n+1}: a_{n+1}, \ldots , x_{n+k}: a_{n+k})$ |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3903 | 3903 |
3904 $e_f(a_1, \ldots , a_n, x_{n+1}: a_{n+1}, \ldots , x_{n+k}: a_{n+k})$, | 3904 $e_f(a_1, \ldots , a_n, x_{n+1}: a_{n+1}, \ldots , x_{n+k}: a_{n+k})$, |
3905 | 3905 |
3906 where $e_f$ is an expression. If $e_f$ is an identifier $id$, then $id$ must nec
essarily denote a local function, a library function, a library or static getter
or a variable as described above, or $i$ is not considered a function expressio
n invocation. | 3906 where $e_f$ is an expression. If $e_f$ is an identifier $id$, then $id$ must nec
essarily denote a local function, a library function, a library or static getter
or a variable as described above, or $i$ is not considered a function expressio
n invocation. |
3907 If $e_f$ is a type literal, then it is equivalent to the expression $(e_f)$. | 3907 If $e_f$ is a type literal, then it is equivalent to the expression $(e_f)$. |
3908 | 3908 |
3909 \commentary{ | 3909 \commentary{ |
3910 The expression $(e_f)$ where $e_f$ is a type literal always evaluates to an inst
ance of class \code{Type} which is not a function. This ensures that a runtime e
rror occurs when trying to call a type literal. | 3910 The expression $(e_f)$ where $e_f$ is a type literal always evaluates to an inst
ance of class \code{Type} which is not a function. This ensures that a runtime e
rror occurs when trying to call a type literal. |
3911 } | 3911 } |
3912 | 3912 |
3913 If $e_f$ is a property extraction expression (\ref{propertyExtraction}), then $i
$ is is not a function expression invocation and is instead recognized as an ord
inary method invocation (\ref{ordinaryInvocation}). | 3913 If $e_f$ is a property extraction expression (\ref{propertyExtraction}), then $i
$ isn't a function expression invocation and is instead recognized as an ordinar
y method invocation (\ref{ordinaryInvocation}). |
3914 | 3914 |
3915 \commentary{ | 3915 \commentary{ |
3916 \code{$a.b(x)$} is parsed as a method invocation of method \code{$b()$} on objec
t \code{$a$}, not as an invocation of getter \code{$b$} on \code{$a$} followed b
y a function call \code{$(a.b)(x)$}. If a method or getter \code{$b$} exists, t
he two will be equivalent. However, if \code{$b$} is not defined on \code{$a$},
the resulting invocation of \code{noSuchMethod()} would differ. The \code{Invoc
ation} passed to \code{noSuchMethod()} would describe a call to a method \code{$
b$} with argument \code{$x$} in the former case, and a call to a getter \code{$b
$} (with no arguments) in the latter. | 3916 \code{$a.b(x)$} is parsed as a method invocation of method \code{$b()$} on objec
t \code{$a$}, not as an invocation of getter \code{$b$} on \code{$a$} followed b
y a function call \code{$(a.b)(x)$}. If a method or getter \code{$b$} exists, t
he two will be equivalent. However, if \code{$b$} is not defined on \code{$a$},
the resulting invocation of \code{noSuchMethod()} would differ. The \code{Invoc
ation} passed to \code{noSuchMethod()} would describe a call to a method \code{$
b$} with argument \code{$x$} in the former case, and a call to a getter \code{$b
$} (with no arguments) in the latter. |
3917 } | 3917 } |
3918 | 3918 |
3919 \LMHash{} | 3919 \LMHash{} |
3920 Otherwise: | 3920 Otherwise: |
3921 | 3921 |
3922 A function expression invocation $e_f(a_1, \ldots , a_n, x_{n+1}: a_{n+1}, \ldot
s , x_{n+k}: a_{n+k})$ is equivalent to $e_f.call(a_1, \ldots , a_n, x_{n+1}: a_
{n+1}, \ldots , x_{n+k}: a_{n+k})$. | 3922 A function expression invocation $e_f(a_1, \ldots , a_n, x_{n+1}: a_{n+1}, \ldot
s , x_{n+k}: a_{n+k})$ is equivalent to $e_f.call(a_1, \ldots , a_n, x_{n+1}: a_
{n+1}, \ldots , x_{n+k}: a_{n+k})$. |
3923 | 3923 |
(...skipping 2954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6878 An import directive $I$ may optionally include a namespace combinator clauses us
ed to restrict the set of names imported by $I$. Currently, two namespace combin
ators are supported: \HIDE{} and \SHOW{}. | 6878 An import directive $I$ may optionally include a namespace combinator clauses us
ed to restrict the set of names imported by $I$. Currently, two namespace combin
ators are supported: \HIDE{} and \SHOW{}. |
6879 | 6879 |
6880 \LMHash{} | 6880 \LMHash{} |
6881 Let $I$ be an import directive that refers to a URI via the string $s_1$. Evalua
tion of $I$ proceeds as follows: | 6881 Let $I$ be an import directive that refers to a URI via the string $s_1$. Evalua
tion of $I$ proceeds as follows: |
6882 | 6882 |
6883 \LMHash{} | 6883 \LMHash{} |
6884 If $I$ is a deferred import, no evaluation takes place. Instead, a mapping of th
e name of the prefix, $p$ to a {\em deferred prefix object} is added to the scop
e of the current library $L$. | 6884 If $I$ is a deferred import, no evaluation takes place. Instead, a mapping of th
e name of the prefix, $p$ to a {\em deferred prefix object} is added to the scop
e of the current library $L$. |
6885 The deferred prefix object has the following methods: | 6885 The deferred prefix object has the following methods: |
6886 | 6886 |
6887 \begin{itemize} | 6887 \begin{itemize} |
6888 \item \code{loadLibrary}. This method returns a future $f$. When called, the met
hod causes an immediate import $I'$ to be executed at some future time, where $I
'$ is is derived from $I$ by eliding the word \DEFERRED{} and adding a \HIDE{} \
code{loadLibrary} combinator clause. When $I'$ executes without error, $f$ comp
letes successfully. If $I'$ executes without error, we say that the call to \cod
e{loadLibrary} has succeeded, otherwise we say the call has failed. | 6888 \item \code{loadLibrary}. This method returns a future $f$. When called, the met
hod causes an immediate import $I'$ to be executed at some future time, where $I
'$ is derived from $I$ by eliding the word \DEFERRED{} and adding a \HIDE{} \cod
e{loadLibrary} combinator clause. When $I'$ executes without error, $f$ complet
es successfully. If $I'$ executes without error, we say that the call to \code{l
oadLibrary} has succeeded, otherwise we say the call has failed. |
6889 \item For every top level function $f$ named $id$ in the imported library $B$,
a corresponding method named $id$ with the same signature as $f$. Calling the me
thod results in a runtime error. | 6889 \item For every top level function $f$ named $id$ in the imported library $B$,
a corresponding method named $id$ with the same signature as $f$. Calling the me
thod results in a runtime error. |
6890 \item For every top level getter $g$ named $id$ in $B$, a corresponding getter n
amed $id$ with the same signature as $g$. Calling the method results in a runti
me error. | 6890 \item For every top level getter $g$ named $id$ in $B$, a corresponding getter n
amed $id$ with the same signature as $g$. Calling the method results in a runti
me error. |
6891 \item For every top level setter $s$ named $id$ in $B$, a corresponding setter n
amed $id$ with the same signature as $s$. Calling the method results in a runti
me error. | 6891 \item For every top level setter $s$ named $id$ in $B$, a corresponding setter n
amed $id$ with the same signature as $s$. Calling the method results in a runti
me error. |
6892 \item For every type $T$ named $id$ in $B$, a corresponding getter named $id$ wi
th return type \code{Type}. Calling the method results in a runtime error. | 6892 \item For every type $T$ named $id$ in $B$, a corresponding getter named $id$ wi
th return type \code{Type}. Calling the method results in a runtime error. |
6893 \end{itemize} | 6893 \end{itemize} |
6894 | 6894 |
6895 \rationale { | 6895 \rationale { |
6896 The purpose of adding members of $B$ to $p$ is to ensure that any warnings issu
ed when using $p$ are correct, and no spurious warnings are generated. In fact,
at runtime we cannot add these members until $B$ is loaded; but any such invoca
tions will fail at runtime as specified by virtue of being completely absent. | 6896 The purpose of adding members of $B$ to $p$ is to ensure that any warnings issu
ed when using $p$ are correct, and no spurious warnings are generated. In fact,
at runtime we cannot add these members until $B$ is loaded; but any such invoca
tions will fail at runtime as specified by virtue of being completely absent. |
6897 } | 6897 } |
6898 %But this is still a lie detectable by reflection. Probably revise so the type o
f p has these members but p does not. | 6898 %But this is still a lie detectable by reflection. Probably revise so the type o
f p has these members but p does not. |
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7433 functionPrefix typeParameters? formalParameterList `{\escapegrammar ;}' | 7433 functionPrefix typeParameters? formalParameterList `{\escapegrammar ;}' |
7434 . | 7434 . |
7435 | 7435 |
7436 {\bf functionPrefix:} | 7436 {\bf functionPrefix:} |
7437 returnType? identifier | 7437 returnType? identifier |
7438 . | 7438 . |
7439 | 7439 |
7440 \end{grammar} | 7440 \end{grammar} |
7441 | 7441 |
7442 \LMHash{} | 7442 \LMHash{} |
7443 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{}. | 7443 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 to introduce the name $id$ into the scope of $L$, bound to the f
unction type $(T_1, \ldots, T_n, [T_{n+1}$ $p_{n+1}, \ldots, T_{n+k}$ $p_{n+k}])
\rightarrow T$. |
| 7444 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 to introduce the name $id$ into the scope 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$. |
| 7445 In either case, iff no return type is specified, it is taken to be \DYNAMIC{}. L
ikewise, if a type annotation is omitted on a formal parameter, it is taken to b
e \DYNAMIC{}. |
7444 | 7446 |
7445 \LMHash{} | 7447 \LMHash{} |
7446 It is a compile-time error if any default values are specified in the signature
of a function type alias. | 7448 It is a compile-time error if any default values are specified in the signature
of a function type alias. |
7447 %A typedef may only refer to itself via the bounds of its generic parameters. | 7449 %A typedef may only refer to itself via the bounds of its generic parameters. |
7448 Any self reference in a typedef, either directly, or recursively via another ty
pedef, is a compile time error. | 7450 Any self reference in a typedef, either directly, or recursively via another ty
pedef, is a compile time error. |
7449 %via a chain of references that does not include a class declaration. | 7451 %via a chain of references that does not include a class declaration. |
7450 | 7452 |
7451 | 7453 |
7452 | 7454 |
7453 \subsection{Interface Types} | 7455 \subsection{Interface Types} |
(...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8146 | 8148 |
8147 The invariant that each normative paragraph is associated with a line | 8149 The invariant that each normative paragraph is associated with a line |
8148 containing the text \LMHash{} should be maintained. Extra occurrences | 8150 containing the text \LMHash{} should be maintained. Extra occurrences |
8149 of \LMHash{} can be added if needed, e.g., in order to make | 8151 of \LMHash{} can be added if needed, e.g., in order to make |
8150 individual \item{}s in itemized lists addressable. Each \LM.. command | 8152 individual \item{}s in itemized lists addressable. Each \LM.. command |
8151 must occur on a separate line. \LMHash{} must occur immediately | 8153 must occur on a separate line. \LMHash{} must occur immediately |
8152 before the associated paragraph, and \LMLabel must occur immediately | 8154 before the associated paragraph, and \LMLabel must occur immediately |
8153 after the associated \section{}, \subsection{} etc. | 8155 after the associated \section{}, \subsection{} etc. |
8154 | 8156 |
8155 ---------------------------------------------------------------------- | 8157 ---------------------------------------------------------------------- |
OLD | NEW |