Chromium Code Reviews| 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.9}} | 10 {\large Version 1.9}} |
| (...skipping 3072 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3083 | 3083 |
| 3084 $(T_1$ $a_1, \ldots, T_n$ $a_n, [T_{n+1}$ $x_{n+1} = d_1, \ldots, T_{n+k}$ $x_{ n+k} = d_k]) => e$ | 3084 $(T_1$ $a_1, \ldots, T_n$ $a_n, [T_{n+1}$ $x_{n+1} = d_1, \ldots, T_{n+k}$ $x_{ n+k} = d_k]) => e$ |
| 3085 is | 3085 is |
| 3086 | 3086 |
| 3087 $(T_1 \ldots, T_n, [T_{n+1}$ $x_{n+1}, \ldots, T_{n+k}$ $x_{n+k}]) \rightarrow T _0$, where $T_0$ is the static type of $e$. | 3087 $(T_1 \ldots, T_n, [T_{n+1}$ $x_{n+1}, \ldots, T_{n+k}$ $x_{n+k}]) \rightarrow T _0$, where $T_0$ is the static type of $e$. |
| 3088 | 3088 |
| 3089 \LMHash{} | 3089 \LMHash{} |
| 3090 The static type of a function literal of the form | 3090 The static type of a function literal of the form |
| 3091 | 3091 |
| 3092 $(T_1$ $a_1, \ldots, T_n$ $a_n, [T_{n+1}$ $x_{n+1} = d_1, \ldots, T_{n+k}$ $x_{ n+k} = d_k])$ \ASYNC{} $=> e$ | 3092 $(T_1$ $a_1, \ldots, T_n$ $a_n, [T_{n+1}$ $x_{n+1} = d_1, \ldots, T_{n+k}$ $x_{ n+k} = d_k])$ \ASYNC{} $=> e$ |
| 3093 is $(T_1 \ldots, T_n, [T_{n+1}$ $x_{n+1}, \ldots, T_{n+k}$ $x_{n+k}]) \rightarro w Future<T_0>$, where $T_0$ is the static type of $e$. | 3093 is $(T_1 \ldots, T_n, [T_{n+1}$ $x_{n+1}, \ldots, T_{n+k}$ $x_{n+k}]) \rightarro w Future<flatten(T_0)>$, where $T_0$ is the static type of $e$ and $flatten(T) = flatten(S)$ if $T = Future<S>$, and $T$ otherwise. |
| 3094 | |
| 3095 \rationale{ | |
| 3096 We collapse multiple layers of futures into one. If $e$ evaluates to a future $f $, the future will not invoke its \code{then()} callback until f completes to a non-future value, and so the result of an await is never a future, and the resul t of an async function will never have type \code{Future$<X>$} where $X$ itself is an invocation of \code{Future}. | |
| 3097 } | |
| 3098 | |
| 3094 | 3099 |
| 3095 \LMHash{} | 3100 \LMHash{} |
| 3096 The static type of a function literal of the form | 3101 The static type of a function literal of the form |
| 3097 | 3102 |
| 3098 $(T_1$ $a_1, \ldots, T_n$ $a_n, \{T_{n+1}$ $x_{n+1} : d_1, \ldots, T_{n+k}$ $x_ {n+k} : d_k\}) => e$ | 3103 $(T_1$ $a_1, \ldots, T_n$ $a_n, \{T_{n+1}$ $x_{n+1} : d_1, \ldots, T_{n+k}$ $x_ {n+k} : d_k\}) => e$ |
| 3099 is | 3104 is |
| 3100 | 3105 |
| 3101 $(T_1 \ldots, T_n, \{T_{n+1}$ $x_{n+1}, \ldots, T_{n+k}$ $x_{n+k}\}) \rightarrow T_0$, where $T_0$ is the static type of $e$. | 3106 $(T_1 \ldots, T_n, \{T_{n+1}$ $x_{n+1}, \ldots, T_{n+k}$ $x_{n+k}\}) \rightarrow T_0$, where $T_0$ is the static type of $e$. |
| 3102 | 3107 |
| 3103 \LMHash{} | 3108 \LMHash{} |
| 3104 The static type of a function literal of the form | 3109 The static type of a function literal of the form |
| 3105 | 3110 |
| 3106 $(T_1$ $a_1, \ldots, T_n$ $a_n, \{T_{n+1}$ $x_{n+1} : d_1, \ldots, T_{n+k}$ $x_ {n+k} : d_k\})$ \ASYNC{} $=> e$ | 3111 $(T_1$ $a_1, \ldots, T_n$ $a_n, \{T_{n+1}$ $x_{n+1} : d_1, \ldots, T_{n+k}$ $x_ {n+k} : d_k\})$ \ASYNC{} $=> e$ |
| 3107 | 3112 |
| 3108 is $(T_1 \ldots, T_n, \{T_{n+1}$ $x_{n+1}, \ldots, T_{n+k}$ $x_{n+k}\}) \rightar row Future<T_0>$, where $T_0$ is the static type of $e$. | 3113 is $(T_1 \ldots, T_n, \{T_{n+1}$ $x_{n+1}, \ldots, T_{n+k}$ $x_{n+k}\}) \rightar row Future<flatten(T_0)>$, where $T_0$ is the static type of $e$. |
| 3109 | 3114 |
| 3110 \LMHash{} | 3115 \LMHash{} |
| 3111 The static type of a function literal of the form | 3116 The static type of a function literal of the form |
| 3112 | 3117 |
| 3113 $(T_1$ $a_1, \ldots, T_n$ $a_n, [T_{n+1}$ $x_{n+1} = d_1, \ldots, T_{n+k}$ $x_{ n+k}= d_k])\{s\}$ | 3118 $(T_1$ $a_1, \ldots, T_n$ $a_n, [T_{n+1}$ $x_{n+1} = d_1, \ldots, T_{n+k}$ $x_{ n+k}= d_k])\{s\}$ |
| 3114 | 3119 |
| 3115 is $(T_1 \ldots, T_n, [T_{n+1}$ $x_{n+1}, \ldots, T_{n+k}$ $x_{n+k}]) \rightarro w \DYNAMIC{}$. | 3120 is $(T_1 \ldots, T_n, [T_{n+1}$ $x_{n+1}, \ldots, T_{n+k}$ $x_{n+k}]) \rightarro w \DYNAMIC{}$. |
| 3116 | 3121 |
| 3117 \LMHash{} | 3122 \LMHash{} |
| 3118 The static type of a function literal of the form | 3123 The static type of a function literal of the form |
| (...skipping 1470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4589 | 4594 |
| 4590 \rationale{ | 4595 \rationale{ |
| 4591 An await expression has no meaning in a synchronous function. If such a function were to suspend waiting for a future, it would no longer be synchronous. | 4596 An await expression has no meaning in a synchronous function. If such a function were to suspend waiting for a future, it would no longer be synchronous. |
| 4592 } | 4597 } |
| 4593 | 4598 |
| 4594 \commentary{ | 4599 \commentary{ |
| 4595 It is not a static warning if the type of $e$ is not a subtype of \code{Future}. Tools may choose to give a hint in such cases. | 4600 It is not a static warning if the type of $e$ is not a subtype of \code{Future}. Tools may choose to give a hint in such cases. |
| 4596 } | 4601 } |
| 4597 | 4602 |
| 4598 \LMHash{} | 4603 \LMHash{} |
| 4599 Let $flatten(T) = flatten(S)$ if $T = Future<S>$, and $T$ otherwise. The static type of $a$ is $flatten(T)$ where $T$ is the static type of $e$. | 4604 The static type of $a$ is $flatten(T)$ (the $flatten$ function is defined in sec tion \ref{functionExpressions}) where $T$ is the static type of $e$. |
| 4600 | |
| 4601 \rationale{ | |
| 4602 We collapse multiple layers of futures into one. If $e$ evaluates to a future $f $, the future will not invoke its \code{then()} callback until f completes to a non-future value, and so the result of an await is never a future, and the resul t of an async function will never have type \code{Future$<X>$} where $X$ itself is an invocation of \code{Future}. | |
| 4603 } | |
| 4604 | |
| 4605 | 4605 |
| 4606 | 4606 |
| 4607 | 4607 |
| 4608 \subsection{ Postfix Expressions} | 4608 \subsection{ Postfix Expressions} |
| 4609 \LMLabel{postfixExpressions} | 4609 \LMLabel{postfixExpressions} |
| 4610 | 4610 |
| 4611 \LMHash{} | 4611 \LMHash{} |
| 4612 Postfix expressions invoke the postfix operators on objects. | 4612 Postfix expressions invoke the postfix operators on objects. |
| 4613 | 4613 |
| 4614 \begin{grammar} | 4614 \begin{grammar} |
| (...skipping 1117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5732 | 5732 |
| 5733 \commentary{ | 5733 \commentary{ |
| 5734 In the simplest case, the immediately enclosing function is an ordinary, synchro nous non-generator, and upon function termination, the current return value is g iven to the caller. The other possibility is that the function is marked \ASYNC {}, in which case the current return value is used to complete the future associ ated with the function invocation. Both these scenarios are specified in section \ref{functionInvocation}. | 5734 In the simplest case, the immediately enclosing function is an ordinary, synchro nous non-generator, and upon function termination, the current return value is g iven to the caller. The other possibility is that the function is marked \ASYNC {}, in which case the current return value is used to complete the future associ ated with the function invocation. Both these scenarios are specified in section \ref{functionInvocation}. |
| 5735 The enclosing function cannot be marked as generator (i.e, \ASYNC* or \SYNC*), s ince generators are not allowed to contain a statement of the form \code{\RETURN {} $e$;} as discussed below. | 5735 The enclosing function cannot be marked as generator (i.e, \ASYNC* or \SYNC*), s ince generators are not allowed to contain a statement of the form \code{\RETURN {} $e$;} as discussed below. |
| 5736 } | 5736 } |
| 5737 | 5737 |
| 5738 \LMHash{} | 5738 \LMHash{} |
| 5739 Let $T$ be the static type of $e$ and let $f$ be the immediately enclosing funct ion. | 5739 Let $T$ be the static type of $e$ and let $f$ be the immediately enclosing funct ion. |
| 5740 | 5740 |
| 5741 \LMHash{} | 5741 \LMHash{} |
| 5742 It is a static type warning if the body of $f$ is marked \ASYNC{} and the type \ code{Future$<$flatten(T)$>$} (\ref{awaitExpressions}) may not be assigned to the declared return type of $f$. Otherwise, it is a static type warning if $T$ ma y not be assigned to the declared return type of $f$. | 5742 It is a static type warning if the body of $f$ is marked \ASYNC{} and the type \ code{Future$<$flatten(T)$>$} (\ref{awaitExpressions}) may not be assigned to the declared return type of $f$. Otherwise, it is a static type warning if $T$ ma y not be assigned to the declared return type of $f$. |
|
Paul Berry
2015/02/05 23:56:07
This reference needs to be updated to point to \re
| |
| 5743 | 5743 |
| 5744 \LMHash{} | 5744 \LMHash{} |
| 5745 Let $S$ be the runtime type of $o$. In checked mode: | 5745 Let $S$ be the runtime type of $o$. In checked mode: |
| 5746 \begin{itemize} | 5746 \begin{itemize} |
| 5747 \item If the body of $f$ is marked \ASYNC{} (\ref{functions}) it is a dynamic t ype error if $o$ is not \NULL{} (\ref{null}) and \code{Future$<$S$>$} is not a s ubtype of the actual return type (\ref{actualTypeOfADeclaration}) of $f$. | 5747 \item If the body of $f$ is marked \ASYNC{} (\ref{functions}) it is a dynamic t ype error if $o$ is not \NULL{} (\ref{null}) and \code{Future$<$S$>$} is not a s ubtype of the actual return type (\ref{actualTypeOfADeclaration}) of $f$. |
| 5748 \item Otherwise, it is a dynamic type error if $o$ is not \NULL{} and the runtim e type of $o$ is not a subtype of the actual return type of $f$. | 5748 \item Otherwise, it is a dynamic type error if $o$ is not \NULL{} and the runtim e type of $o$ is not a subtype of the actual return type of $f$. |
| 5749 \end{itemize} | 5749 \end{itemize} |
| 5750 | 5750 |
| 5751 \LMHash{} | 5751 \LMHash{} |
| 5752 It is a compile-time error if a return statement of the form \code{\RETURN{} $e$ ;} appears in a generative constructor (\ref{generativeConstructors}). | 5752 It is a compile-time error if a return statement of the form \code{\RETURN{} $e$ ;} appears in a generative constructor (\ref{generativeConstructors}). |
| (...skipping 1628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7381 | 7381 |
| 7382 The invariant that each normative paragraph is associated with a line | 7382 The invariant that each normative paragraph is associated with a line |
| 7383 containing the text \LMHash{} should be maintained. Extra occurrences | 7383 containing the text \LMHash{} should be maintained. Extra occurrences |
| 7384 of \LMHash{} can be added if needed, e.g., in order to make | 7384 of \LMHash{} can be added if needed, e.g., in order to make |
| 7385 individual \item{}s in itemized lists addressable. Each \LM.. command | 7385 individual \item{}s in itemized lists addressable. Each \LM.. command |
| 7386 must occur on a separate line. \LMHash{} must occur immediately | 7386 must occur on a separate line. \LMHash{} must occur immediately |
| 7387 before the associated paragraph, and \LMLabel must occur immediately | 7387 before the associated paragraph, and \LMLabel must occur immediately |
| 7388 after the associated \section{}, \subsection{} etc. | 7388 after the associated \section{}, \subsection{} etc. |
| 7389 | 7389 |
| 7390 ---------------------------------------------------------------------- | 7390 ---------------------------------------------------------------------- |
| OLD | NEW |