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 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
586 \LMHash{} | 586 \LMHash{} |
587 It is a compile-time error if an \ASYNC, \ASYNC* or \SYNC* modifier is attached
to the body of a setter or constructor. | 587 It is a compile-time error if an \ASYNC, \ASYNC* or \SYNC* modifier is attached
to the body of a setter or constructor. |
588 | 588 |
589 \rationale{ | 589 \rationale{ |
590 An asynchronous setter would be of little use, since setters can only be used in
the context of an assignment (\ref{assignment}), and an assignment expression a
lways evaluates to the value of the assignment's right hand side. If the setter
actually did its work asynchronously, one might imagine that one would return a
future that resolved to the assignment's right hand side after the setter did it
s work. However, this would require dynamic tests at every assignment, and so wo
uld be prohibitively expensive. | 590 An asynchronous setter would be of little use, since setters can only be used in
the context of an assignment (\ref{assignment}), and an assignment expression a
lways evaluates to the value of the assignment's right hand side. If the setter
actually did its work asynchronously, one might imagine that one would return a
future that resolved to the assignment's right hand side after the setter did it
s work. However, this would require dynamic tests at every assignment, and so wo
uld be prohibitively expensive. |
591 | 591 |
592 An asynchronous constructor would, by definition, never return an instance of th
e class it purports to construct, but instead return a future. Calling such a be
ast via \NEW{} would be very confusing. If you need to produce an object asynchr
onously, use a method. | 592 An asynchronous constructor would, by definition, never return an instance of th
e class it purports to construct, but instead return a future. Calling such a be
ast via \NEW{} would be very confusing. If you need to produce an object asynchr
onously, use a method. |
593 | 593 |
594 One could allow modifiers for factories. A factory for \code{Future} could be mo
dified by \ASYNC{}, a factory for \code{Stream} could be modified by \ASYNC* and
a factory for \code{Iterable} could be modified by \SYNC*. No other scenario ma
kes sense because the object returned by the factory would be of the wrong type.
This situation is very unusual so it is not worth making an exception to the ge
neral rule for constructors in order to allow it. | 594 One could allow modifiers for factories. A factory for \code{Future} could be mo
dified by \ASYNC{}, a factory for \code{Stream} could be modified by \ASYNC* and
a factory for \code{Iterable} could be modified by \SYNC*. No other scenario ma
kes sense because the object returned by the factory would be of the wrong type.
This situation is very unusual so it is not worth making an exception to the ge
neral rule for constructors in order to allow it. |
595 } | 595 } |
596 | 596 \LMHash{} |
| 597 It is a static warning if the declared return type of a function marked \ASYNC{}
may not be assigned to \code{Future}. It is a static warning if the declared re
turn type of a function marked \SYNC* may not be assigned to \code{Iterable}. It
is a static warning if the declared return type of a function marked \ASYNC* m
ay not be assigned to \code{Stream}. |
597 | 598 |
598 \subsection{Function Declarations} | 599 \subsection{Function Declarations} |
599 \LMLabel{functionDeclarations} | 600 \LMLabel{functionDeclarations} |
600 | 601 |
601 \LMHash{} | 602 \LMHash{} |
602 A {\em function declaration} is a function that is neither a member of a class n
or a function literal. Function declarations include {\em library functions}, wh
ich are function declarations | 603 A {\em function declaration} is a function that is neither a member of a class n
or a function literal. Function declarations include {\em library functions}, wh
ich are function declarations |
603 %(including getters and setters) | 604 %(including getters and setters) |
604 at the top level of a library, and {\em local functions}, which are function dec
larations declared inside other functions. Library functions are often referred
to simply as top-level functions. | 605 at the top level of a library, and {\em local functions}, which are function dec
larations declared inside other functions. Library functions are often referred
to simply as top-level functions. |
605 | 606 |
606 \LMHash{} | 607 \LMHash{} |
(...skipping 5356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5963 \item | 5964 \item |
5964 Execution of the function $m$ immediately enclosing $s$ is suspended until the m
ethod \code{moveNext()} is invoked upon the iterator used to initiate the curren
t invocation of $m$. | 5965 Execution of the function $m$ immediately enclosing $s$ is suspended until the m
ethod \code{moveNext()} is invoked upon the iterator used to initiate the curren
t invocation of $m$. |
5965 \item | 5966 \item |
5966 The current call to \code{moveNext()} returns \TRUE. | 5967 The current call to \code{moveNext()} returns \TRUE. |
5967 \end{itemize} | 5968 \end{itemize} |
5968 | 5969 |
5969 \LMHash{} | 5970 \LMHash{} |
5970 It is a compile-time error if a yield-each statement appears in a function that
is not a generator function. | 5971 It is a compile-time error if a yield-each statement appears in a function that
is not a generator function. |
5971 | 5972 |
5972 \LMHash{} | 5973 \LMHash{} |
5973 Let $T$ be the static type of $e$ and let $f$ be the immediately enclosing funct
ion. It is a static type warning if $T$ may not be assigned to the declared ret
urn type of $f$. | 5974 Let $T$ be the static type of $e$ and let $f$ be the immediately enclosing funct
ion. It is a static type warning if $T$ may not be assigned to the declared ret
urn type of $f$. If $f$ is synchronous it is a static type warning if $T$ may
not be assigned to \code{Iterable}. If $f$ is asynchronous it is a static type
warning if $T$ may not be assigned to \code{Stream}. |
5974 | 5975 |
5975 | 5976 |
5976 \subsection{ Assert} | 5977 \subsection{ Assert} |
5977 \LMLabel{assert} | 5978 \LMLabel{assert} |
5978 | 5979 |
5979 \LMHash{} | 5980 \LMHash{} |
5980 An {\em assert statement} is used to disrupt normal execution if a given boolean
condition does not hold. | 5981 An {\em assert statement} is used to disrupt normal execution if a given boolean
condition does not hold. |
5981 | 5982 |
5982 \begin{grammar} | 5983 \begin{grammar} |
5983 {\bf assertStatement:} | 5984 {\bf assertStatement:} |
(...skipping 1396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7380 | 7381 |
7381 The invariant that each normative paragraph is associated with a line | 7382 The invariant that each normative paragraph is associated with a line |
7382 containing the text \LMHash{} should be maintained. Extra occurrences | 7383 containing the text \LMHash{} should be maintained. Extra occurrences |
7383 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 |
7384 individual \item{}s in itemized lists addressable. Each \LM.. command | 7385 individual \item{}s in itemized lists addressable. Each \LM.. command |
7385 must occur on a separate line. \LMHash{} must occur immediately | 7386 must occur on a separate line. \LMHash{} must occur immediately |
7386 before the associated paragraph, and \LMLabel must occur immediately | 7387 before the associated paragraph, and \LMLabel must occur immediately |
7387 after the associated \section{}, \subsection{} etc. | 7388 after the associated \section{}, \subsection{} etc. |
7388 | 7389 |
7389 ---------------------------------------------------------------------- | 7390 ---------------------------------------------------------------------- |
OLD | NEW |