Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(355)

Side by Side Diff: docs/language/dartLangSpec.tex

Issue 3000063002: Specify that async functions start executing synchronously. (Closed)
Patch Set: Be explicit about delaying completion. Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 \\
11 {5th edition draft}\\ 11 {5th edition draft}\\
12 {\large Version 2.0.0-dev}} 12 {\large Version 2.0.0-dev}}
13 13
14 % For information about Location Markers (and in particular the 14 % For information about Location Markers (and in particular the
15 % commands \LMHash and \LMLabel), see the long comment at the 15 % commands \LMHash and \LMLabel), see the long comment at the
16 % end of this file. 16 % end of this file.
17 17
18 % CHANGES 18 % CHANGES
19 % ======= 19 % =======
20 % Significant changes to the specification. 20 % Significant changes to the specification.
21 % 21 %
22 % 2.0 22 % 2.0
23 % - Don't allow functions as assert test values. 23 % - Don't allow functions as assert test values.
24 % - Start running "async" functions synchronously.
24 % 25 %
25 % 1.15 26 % 1.15
26 % - Change how language specification describes control flow. 27 % - Change how language specification describes control flow.
27 % - Object initialization now specifies initialization order correctly. 28 % - Object initialization now specifies initialization order correctly.
28 % - Specifies that leaving an await-for loop must wait for the subscription 29 % - Specifies that leaving an await-for loop must wait for the subscription
29 % to be canceled. 30 % to be canceled.
30 % - An await-for loop only pauses the subscription if it does something async. 31 % - An await-for loop only pauses the subscription if it does something async.
31 % - Assert statements allows a "message" operand and a trailing comma. 32 % - Assert statements allows a "message" operand and a trailing comma.
32 % - The Null type is now considered a subtype of all types in most cases. 33 % - The Null type is now considered a subtype of all types in most cases.
33 % - Specify what NEWLINE means in multiline strings. 34 % - Specify what NEWLINE means in multiline strings.
(...skipping 3747 matching lines...) Expand 10 before | Expand all | Expand 10 after
3781 } 3782 }
3782 3783
3783 \LMHash{} 3784 \LMHash{}
3784 Each iterator runs with its own shallow copies of all local variables; in partic ular, each iterator has the same initial arguments, even if their bindings are m odified by the function. 3785 Each iterator runs with its own shallow copies of all local variables; in partic ular, each iterator has the same initial arguments, even if their bindings are m odified by the function.
3785 \commentary{ 3786 \commentary{
3786 Two executions of an iterator interact only via state outside the function. 3787 Two executions of an iterator interact only via state outside the function.
3787 } 3788 }
3788 % The alternative would be to cache the results of an iterator in the iterable, and check the cache at each \YIELD{}. This would have strange issues as well. T he yielded value might differ from the expression in the yield. And it is a pote ntial memory leak as the cache is kept alive by any iterator. 3789 % The alternative would be to cache the results of an iterator in the iterable, and check the cache at each \YIELD{}. This would have strange issues as well. T he yielded value might differ from the expression in the yield. And it is a pote ntial memory leak as the cache is kept alive by any iterator.
3789 3790
3790 \LMHash{} 3791 \LMHash{}
3791 If $f$ is marked \ASYNC{} (\ref{functions}), then a fresh instance (\ref{generat iveConstructors}) $o$ implementing the built-in class \code{Future} is associate d with the invocation and immediately returned to the caller. The body of $f$ is scheduled for execution at some future time. The future $o$ will be completed w hen execution of the body of $f$ completes (\ref{completion}). If execution of t he body returns a value, $o$ is completed with that value, if it completes norma lly or returns without a value, $o$ is completed with the \NULL{} value, and if it throws an exception $e$ and stack trace $t$, $o$ is completed with the error $e$ and stack trace $t$. 3792 If $f$ is marked \ASYNC{} (\ref{functions}), then a fresh instance (\ref{generat iveConstructors}) $o$ implementing the built-in class \code{Future} is associate d with the invocation.
3793 Then the body of $f$ is executed until it either suspends or completes, at which point $o$ is returned.
3794 \commentary{The body of $f$ may suspend during the evaluation of an \AWAIT{} exp ression or execution of an asynchronous \FOR{} loop.}
3795 The future $o$ is completed when execution of the body of $f$ completes (\ref{co mpletion}).
3796 If execution of the body returns a value, $o$ is completed with that value,
3797 if it completes normally or returns without a value,
3798 $o$ is completed with the \NULL{} value,
3799 and if it throws an exception $e$ and stack trace $t$,
3800 $o$ is completed with the error $e$ and stack trace $t$.
3801 If execution of the body throws before the body suspends the first time,
3802 completion of $o$ happens at some future time after the invocation has returned.
3803 \rationale{The caller needs time to set up error handling for the returned futur e,
3804 so the future is not completed with an error {\em before} it has been returned.}
3792 3805
3793 \LMHash{} 3806 \LMHash{}
3794 If $f$ is marked \ASYNC* (\ref{functions}), then a fresh instance $s$ implementi ng the built-in class \code{Stream} is associated with the invocation and immedi ately returned. When $s$ is listened to, execution of the body of $f$ will begin . 3807 If $f$ is marked \ASYNC* (\ref{functions}), then a fresh instance $s$ implementi ng the built-in class \code{Stream} is associated with the invocation and immedi ately returned. When $s$ is listened to, execution of the body of $f$ will begin .
3795 When execution of the body of $f$ completes: 3808 When execution of the body of $f$ completes:
3796 \begin{itemize} 3809 \begin{itemize}
3797 \item If it completes normally or returns with no value (\ref{completion}), then if $s$ has been canceled then its cancellation future is completed with \NULL{} (\ref{null}). 3810 \item If it completes normally or returns with no value (\ref{completion}), then if $s$ has been canceled then its cancellation future is completed with \NULL{} (\ref{null}).
3798 \item If it throws an exception object $e$ and stack trace $t$: 3811 \item If it throws an exception object $e$ and stack trace $t$:
3799 \begin{itemize} 3812 \begin{itemize}
3800 \item If $s$ has been canceled then its cancellation future is completed with error $e$ and stack trace $t$. 3813 \item If $s$ has been canceled then its cancellation future is completed with error $e$ and stack trace $t$.
3801 \item otherwise the error $e$ and stack trace $t$ are emitted by $s$. 3814 \item otherwise the error $e$ and stack trace $t$ are emitted by $s$.
(...skipping 4431 matching lines...) Expand 10 before | Expand all | Expand 10 after
8233 8246
8234 The invariant that each normative paragraph is associated with a line 8247 The invariant that each normative paragraph is associated with a line
8235 containing the text \LMHash{} should be maintained. Extra occurrences 8248 containing the text \LMHash{} should be maintained. Extra occurrences
8236 of \LMHash{} can be added if needed, e.g., in order to make 8249 of \LMHash{} can be added if needed, e.g., in order to make
8237 individual \item{}s in itemized lists addressable. Each \LM.. command 8250 individual \item{}s in itemized lists addressable. Each \LM.. command
8238 must occur on a separate line. \LMHash{} must occur immediately 8251 must occur on a separate line. \LMHash{} must occur immediately
8239 before the associated paragraph, and \LMLabel must occur immediately 8252 before the associated paragraph, and \LMLabel must occur immediately
8240 after the associated \section{}, \subsection{} etc. 8253 after the associated \section{}, \subsection{} etc.
8241 8254
8242 ---------------------------------------------------------------------- 8255 ----------------------------------------------------------------------
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698