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 3576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3587 | 3587 |
3588 \LMHash{} | 3588 \LMHash{} |
3589 If $T$ is a parameterized type, it is a compile-time error if $T$ includes a typ
e variable among its type arguments. | 3589 If $T$ is a parameterized type, it is a compile-time error if $T$ includes a typ
e variable among its type arguments. |
3590 | 3590 |
3591 \LMHash{} | 3591 \LMHash{} |
3592 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 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$. |
3593 | 3593 |
3594 \LMHash{} | 3594 \LMHash{} |
3595 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 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. |
3596 | 3596 |
3597 %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$. | 3597 %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$. |
3598 %Finally, | 3598 %Finally, |
3599 % If $T$ is a generic with $l$ retype parameters, then for all $ i \in 1 .. l$,
let $V_i = \DYNAMIC{}$. | 3599 % If $T$ is a generic with $l$ retype parameters, then for all $ i \in 1 .. l$,
let $V_i = \DYNAMIC{}$. |
3600 | 3600 |
3601 \LMHash{} | 3601 \LMHash{} |
3602 Evaluation of $e$ proceeds as follows: | 3602 Evaluation of $e$ proceeds as follows: |
3603 | 3603 |
3604 \LMHash{} | 3604 \LMHash{} |
3605 First, if $e$ is of the form | 3605 First, if $e$ is of the form |
3606 | 3606 |
3607 \CONST{} $T.id(a_1, \ldots , a_n, x_{n+1}: a_{n+1}, \ldots , x_{n+k}: a_{n+k})$ | 3607 \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... |
3904 | 3904 |
3905 $e_f(a_1, \ldots , a_n, x_{n+1}: a_{n+1}, \ldots , x_{n+k}: a_{n+k})$, | 3905 $e_f(a_1, \ldots , a_n, x_{n+1}: a_{n+1}, \ldots , x_{n+k}: a_{n+k})$, |
3906 | 3906 |
3907 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 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. |
3908 If $e_f$ is a type literal, then it is equivalent to the expression $(e_f)$. | 3908 If $e_f$ is a type literal, then it is equivalent to the expression $(e_f)$. |
3909 | 3909 |
3910 \commentary{ | 3910 \commentary{ |
3911 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 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. |
3912 } | 3912 } |
3913 | 3913 |
3914 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}). | 3914 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}). |
3915 | 3915 |
3916 \commentary{ | 3916 \commentary{ |
3917 \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 \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. |
3918 } | 3918 } |
3919 | 3919 |
3920 \LMHash{} | 3920 \LMHash{} |
3921 Otherwise: | 3921 Otherwise: |
3922 | 3922 |
3923 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 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})$. |
3924 | 3924 |
(...skipping 2954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6879 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 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{}. |
6880 | 6880 |
6881 \LMHash{} | 6881 \LMHash{} |
6882 Let $I$ be an import directive that refers to a URI via the string $s_1$. Evalua
tion of $I$ proceeds as follows: | 6882 Let $I$ be an import directive that refers to a URI via the string $s_1$. Evalua
tion of $I$ proceeds as follows: |
6883 | 6883 |
6884 \LMHash{} | 6884 \LMHash{} |
6885 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 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$. |
6886 The deferred prefix object has the following methods: | 6886 The deferred prefix object has the following methods: |
6887 | 6887 |
6888 \begin{itemize} | 6888 \begin{itemize} |
6889 \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. | 6889 \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. |
6890 \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 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. |
6891 \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 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. |
6892 \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 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. |
6893 \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 \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. |
6894 \end{itemize} | 6894 \end{itemize} |
6895 | 6895 |
6896 \rationale { | 6896 \rationale { |
6897 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 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. |
6898 } | 6898 } |
6899 %But this is still a lie detectable by reflection. Probably revise so the type o
f p has these members but p does not. | 6899 %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... |
7434 functionPrefix typeParameters? formalParameterList `{\escapegrammar ;}' | 7434 functionPrefix typeParameters? formalParameterList `{\escapegrammar ;}' |
7435 . | 7435 . |
7436 | 7436 |
7437 {\bf functionPrefix:} | 7437 {\bf functionPrefix:} |
7438 returnType? identifier | 7438 returnType? identifier |
7439 . | 7439 . |
7440 | 7440 |
7441 \end{grammar} | 7441 \end{grammar} |
7442 | 7442 |
7443 \LMHash{} | 7443 \LMHash{} |
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 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{}. | 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 f
unction type $(T_1, \ldots, T_n, [T_{n+1}$ $p_{n+1}, \ldots, T_{n+k}$ $p_{n+k}])
\rightarrow T$. |
| 7445 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$. |
| 7446 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{}. |
7445 | 7447 |
7446 \LMHash{} | 7448 \LMHash{} |
7447 It is a compile-time error if any default values are specified in the signature
of a function type alias. | 7449 It is a compile-time error if any default values are specified in the signature
of a function type alias. |
7448 %A typedef may only refer to itself via the bounds of its generic parameters. | 7450 %A typedef may only refer to itself via the bounds of its generic parameters. |
7449 Any self reference in a typedef, either directly, or recursively via another ty
pedef, is a compile time error. | 7451 Any self reference in a typedef, either directly, or recursively via another ty
pedef, is a compile time error. |
7450 %via a chain of references that does not include a class declaration. | 7452 %via a chain of references that does not include a class declaration. |
7451 | 7453 |
7452 | 7454 |
7453 | 7455 |
7454 \subsection{Interface Types} | 7456 \subsection{Interface Types} |
(...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8147 | 8149 |
8148 The invariant that each normative paragraph is associated with a line | 8150 The invariant that each normative paragraph is associated with a line |
8149 containing the text \LMHash{} should be maintained. Extra occurrences | 8151 containing the text \LMHash{} should be maintained. Extra occurrences |
8150 of \LMHash{} can be added if needed, e.g., in order to make | 8152 of \LMHash{} can be added if needed, e.g., in order to make |
8151 individual \item{}s in itemized lists addressable. Each \LM.. command | 8153 individual \item{}s in itemized lists addressable. Each \LM.. command |
8152 must occur on a separate line. \LMHash{} must occur immediately | 8154 must occur on a separate line. \LMHash{} must occur immediately |
8153 before the associated paragraph, and \LMLabel must occur immediately | 8155 before the associated paragraph, and \LMLabel must occur immediately |
8154 after the associated \section{}, \subsection{} etc. | 8156 after the associated \section{}, \subsection{} etc. |
8155 | 8157 |
8156 ---------------------------------------------------------------------- | 8158 ---------------------------------------------------------------------- |
OLD | NEW |