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.10}} | 10 {\large Version 1.10}} |
(...skipping 5665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5676 \LMHash{} | 5676 \LMHash{} |
5677 A for statement of the form \code{ \FOR{} ($finalConstVarOrType?$ id \IN{} $e$)
$s$} is equivalent to the following code: | 5677 A for statement of the form \code{ \FOR{} ($finalConstVarOrType?$ id \IN{} $e$)
$s$} is equivalent to the following code: |
5678 | 5678 |
5679 \begin{dartCode} | 5679 \begin{dartCode} |
5680 var n0 = $e$.iterator; | 5680 var n0 = $e$.iterator; |
5681 \WHILE{} (n0.moveNext()) \{ | 5681 \WHILE{} (n0.moveNext()) \{ |
5682 $finalConstVarOrType?$ id = n0.current; | 5682 $finalConstVarOrType?$ id = n0.current; |
5683 $s$ | 5683 $s$ |
5684 \} | 5684 \} |
5685 \end{dartCode} | 5685 \end{dartCode} |
5686 where \code{n0} is an identifier that does not occur anywhere in the program. | 5686 where \code{n0} is an identifier that does not occur anywhere in the program, ex
cept that for purposes of static typechecking, it is checked under the assumptio
n that $n0$ is declared to be of type $T$, where $T$ is the static type of $e.it
erator$. |
5687 | 5687 |
5688 \commentary{ | |
5689 Note that in fact, using a \CONST{} variable would give rise to a compile time
error since \cd{n0.current} is not a constant expression. | |
5690 } | |
5691 | |
5692 It is a static warning if the static type of $e$ does not have a member \cd{iter
ator}. It is a static warning if the static type of \cd{$e$.iterator} does not h
ave a method \cd{moveNext}. It is a static warning if static return type of \cd
{$e$.iterator.moveNext()} is not assignable to the static type of \cd{id}. | |
5693 | |
5694 | |
5695 \commentary { | |
5696 One might have required that \cd{n0} had type \cd{Iterable$<T>$} where $T$ was t
he static type of \cd{id}. However, that would cause failure in checked mode if
$e$ was merely emulating the \cd{Iterable} interface. | |
5697 } | |
5698 | 5688 |
5699 | 5689 |
5700 \subsubsection{Asynchronous For-in} | 5690 \subsubsection{Asynchronous For-in} |
5701 \LMLabel{asynchronousFor-in} | 5691 \LMLabel{asynchronousFor-in} |
5702 | 5692 |
5703 \LMHash{} | 5693 \LMHash{} |
5704 A for-in statement may be asynchronous. The asynchronous form is designed to ite
rate over streams. An asynchronous for loop is distinguished by the keyword \AWA
IT{} immediately preceding the keyword \FOR. | 5694 A for-in statement may be asynchronous. The asynchronous form is designed to ite
rate over streams. An asynchronous for loop is distinguished by the keyword \AWA
IT{} immediately preceding the keyword \FOR. |
5705 | 5695 |
5706 \LMHash{} | 5696 \LMHash{} |
5707 Execution of a for-in statement of the form \code{\AWAIT{} \FOR{} (finalConstVa
rOrType? id \IN{} $e$) $s$} proceeds as follows: | 5697 Execution of a for-in statement of the form \code{\AWAIT{} \FOR{} (finalConstVa
rOrType? id \IN{} $e$) $s$} proceeds as follows: |
(...skipping 2137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7845 | 7835 |
7846 The invariant that each normative paragraph is associated with a line | 7836 The invariant that each normative paragraph is associated with a line |
7847 containing the text \LMHash{} should be maintained. Extra occurrences | 7837 containing the text \LMHash{} should be maintained. Extra occurrences |
7848 of \LMHash{} can be added if needed, e.g., in order to make | 7838 of \LMHash{} can be added if needed, e.g., in order to make |
7849 individual \item{}s in itemized lists addressable. Each \LM.. command | 7839 individual \item{}s in itemized lists addressable. Each \LM.. command |
7850 must occur on a separate line. \LMHash{} must occur immediately | 7840 must occur on a separate line. \LMHash{} must occur immediately |
7851 before the associated paragraph, and \LMLabel must occur immediately | 7841 before the associated paragraph, and \LMLabel must occur immediately |
7852 after the associated \section{}, \subsection{} etc. | 7842 after the associated \section{}, \subsection{} etc. |
7853 | 7843 |
7854 ---------------------------------------------------------------------- | 7844 ---------------------------------------------------------------------- |
OLD | NEW |