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 11 matching lines...) Expand all Loading... | |
22 % 1.15 | 22 % 1.15 |
23 % - Change how language specification describes control flow. | 23 % - Change how language specification describes control flow. |
24 % - Object initialization now specifies initialization order correctly. | 24 % - Object initialization now specifies initialization order correctly. |
25 % - Specifies that leaving an await-for loop must wait for the subscription | 25 % - Specifies that leaving an await-for loop must wait for the subscription |
26 % to be canceled. | 26 % to be canceled. |
27 % - An await-for loop only pauses the subscription if it does something async. | 27 % - An await-for loop only pauses the subscription if it does something async. |
28 % - Assert statements allows a "message" operand and a trailing comma. | 28 % - Assert statements allows a "message" operand and a trailing comma. |
29 % - The Null type is now considered a subtype of all types in most cases. | 29 % - The Null type is now considered a subtype of all types in most cases. |
30 % - Specify what NEWLINE means in multiline strings. | 30 % - Specify what NEWLINE means in multiline strings. |
31 % - Specified the FutureOf type. | 31 % - Specified the FutureOf type. |
32 % - Don't allow functions as assert test values. | |
32 % | 33 % |
33 % 1.14 | 34 % 1.14 |
34 % - The call "C()" where "C" is a class name, is a now compile-time error. | 35 % - The call "C()" where "C" is a class name, is a now compile-time error. |
35 % - Changed description of rewrites that depended on a function literal. | 36 % - Changed description of rewrites that depended on a function literal. |
36 % In many cases, the rewrite wasn't safe for asynchronous code. | 37 % In many cases, the rewrite wasn't safe for asynchronous code. |
37 % - Removed generalized tear-offs. | 38 % - Removed generalized tear-offs. |
38 % - Allow "rethrow" to also end a switch case. Allow braces around switch cases. | 39 % - Allow "rethrow" to also end a switch case. Allow braces around switch cases. |
39 % - Allow using '=' as default-value separator for named parameters. | 40 % - Allow using '=' as default-value separator for named parameters. |
40 % - Make it a compile-time error if a library includes the same part twice. | 41 % - Make it a compile-time error if a library includes the same part twice. |
41 % - Now more specific about the return types of sync*/async/async* functions | 42 % - Now more specific about the return types of sync*/async/async* functions |
(...skipping 6682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6724 \end{itemize} | 6725 \end{itemize} |
6725 | 6726 |
6726 | 6727 |
6727 \LMHash{} | 6728 \LMHash{} |
6728 It is a compile-time error if a yield-each statement appears in a function that is not a generator function. | 6729 It is a compile-time error if a yield-each statement appears in a function that is not a generator function. |
6729 | 6730 |
6730 \LMHash{} | 6731 \LMHash{} |
6731 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}. | 6732 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}. |
6732 | 6733 |
6733 | 6734 |
6734 \subsection{ Assert} | 6735 \subsection{Assert} |
6735 \LMLabel{assert} | 6736 \LMLabel{assert} |
6736 | 6737 |
6737 \LMHash{} | 6738 \LMHash{} |
6738 An {\em assert statement} is used to disrupt normal execution if a given boolean condition does not hold. | 6739 An {\em assert statement} is used to disrupt normal execution if a given boolean condition does not hold. |
6739 | 6740 |
6740 \begin{grammar} | 6741 \begin{grammar} |
6741 {\bf assertStatement:} | 6742 {\bf assertStatement:} |
6742 assert `(' expression ( `,' expression )? `,'? `)' `{\escapegrammar ;}' | 6743 assert `(' expression ( `,' expression )? `,'? `)' `{\escapegrammar ;}' |
6743 . | 6744 . |
6744 \end{grammar} | 6745 \end{grammar} |
6745 | 6746 |
6746 \LMHash{} | 6747 \LMHash{} |
6747 The grammar allows a trailing comma before the closing parenthesis, | 6748 The grammar allows a trailing comma before the closing parenthesis, |
6748 similarly to an argument list. That comma, if present, has no effect. | 6749 similarly to an argument list. That comma, if present, has no effect. |
6749 An assert statement with a trailing comme is equivalent to one with that | 6750 An assert statement with a trailing comme is equivalent to one with that |
6750 comma removed. | 6751 comma removed. |
6751 | 6752 |
6752 \LMHash{} | 6753 \LMHash{} |
6753 An assert statement on the form \code{\ASSERT($e$);)} is equivalent to a statmen t on the form \code{\ASSERT($e$, null);}. | 6754 An assert statement on the form \code{\ASSERT($e$);)} is equivalent to |
6755 a statment on the form \code{\ASSERT($e$, null);}. | |
eernst
2017/07/10 10:02:24
Typo: `stat[e]ment`.
About white space: It used t
Lasse Reichstein Nielsen
2017/08/07 11:57:00
I try to split at "meaningful" positions, which ba
| |
6754 | 6756 |
6755 \LMHash{} | 6757 \LMHash{} |
6756 The assert statement has no effect in production mode. In checked mode, executio n of an assert statement \code{\ASSERT{}($c$, $e$);} proceeds as follows: | 6758 The assert statement has no effect in production mode. |
6759 In checked mode, execution of an assert statement \code{\ASSERT{}($c$, $e$);} | |
6760 proceeds as follows: | |
6757 | 6761 |
6758 \LMHash{} | 6762 \LMHash{} |
6759 The expression $c$ is evaluated to an object $o$. If the class of $o$ is a subty pe of \code{Function} then let $r$ be the result of invoking $o$ with no argumen ts. Otherwise, let $r$ be $o$. | 6763 The expression $c$ is evaluated to an object $r$. |
6760 It is a dynamic type error if $o$ is not of type \code{bool} or of type \code{Fu nction}, or if $r$ is not of type \code{bool}. | 6764 It is a dynamic type error if $r$ is not of type \code{bool}. |
6761 If $r$ is \FALSE{}, we say that the assertion failed. | 6765 If $r$ is \TRUE{} then execution if the \ASSERT{} statement |
eernst
2017/07/10 10:02:25
Typo: 'execution [o]f'
Lasse Reichstein Nielsen
2017/08/07 11:57:00
Done.
| |
6762 If $r$ is \TRUE{}, we say that the assertion succeeded. | 6766 completes normally (\ref{completion}). |
6763 If the assertion succeeded, execution of the assert statement completes normally (\ref{completion}). | 6767 Otherwise $e$ is evaluated to an object $m$. |
6764 If the assertion failed, $e$ is evaluated to an object $m$. | |
6765 Then the execution of the assert statement throws (\ref{completion}) an \code{As sertionError} containing $m$ and with a stack trace corresponding to the current execution state at the \ASSERT{} statement. | 6768 Then the execution of the assert statement throws (\ref{completion}) an \code{As sertionError} containing $m$ and with a stack trace corresponding to the current execution state at the \ASSERT{} statement. |
6766 | 6769 |
6767 \LMHash{} | 6770 \LMHash{} |
6768 It is a static type warning if the type of $e$ may not be assigned to either \c ode{bool} or $() \rightarrow$ \code{bool}. | 6771 It is a static type warning if the type of $e$ may not be assigned to \code{bool }. |
6769 | 6772 |
6770 \rationale{Why is this a statement, not a built in function call? Because it is handled magically so it has no effect and no overhead in production mode. Also, in the absence of final methods. one could not prevent it being overridden (thou gh there is no real harm in that). It cannot be viewed as a function call that is being optimized away because the argument might have side effects. | 6773 \rationale{Why is this a statement, not a built in function call? Because it is handled magically so it has no effect and no overhead in production mode. Also, in the absence of final methods. one could not prevent it being overridden (thou gh there is no real harm in that). It cannot be viewed as a function call that i s being optimized away because the argument might have side effects. |
eernst
2017/07/10 10:02:25
Typo: `methods[,] one`.
Might as well add a newlin
Bob Nystrom
2017/07/10 14:42:26
"argument" -> "arguments" now that we have message
Lasse Reichstein Nielsen
2017/08/07 11:57:00
Done.
| |
6771 } | 6774 } |
6772 | 6775 |
6773 %If a lexically visible declaration named \code{assert} is in scope, an assert s tatement | 6776 %If a lexically visible declaration named \code{assert} is in scope, an assert s tatement |
6774 %\code{\ASSERT{} (e); } | 6777 %\code{\ASSERT{} (e); } |
6775 %is interpreted as an expression statement \code{(assert(e));} . | 6778 %is interpreted as an expression statement \code{(assert(e));} . |
6776 | 6779 |
6777 %\rationale{ | 6780 %\rationale{ |
6778 %Since \ASSERT{} is a built-in identifier, one might define a function or method with this name. | 6781 %Since \ASSERT{} is a built-in identifier, one might define a function or method with this name. |
6779 %It is impossible to distinguish as \ASSERT{} statement from a method invocation in such a situation. | 6782 %It is impossible to distinguish as \ASSERT{} statement from a method invocation in such a situation. |
6780 %One could choose to always interpret such code as an \ASSERT{} statement. Or we could choose to give priority to any lexically visible user defined function. The former can cause rather puzzling situations, e.g.,} | 6783 %One could choose to always interpret such code as an \ASSERT{} statement. Or we could choose to give priority to any lexically visible user defined function. The former can cause rather puzzling situations, e.g.,} |
(...skipping 1432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
8213 | 8216 |
8214 The invariant that each normative paragraph is associated with a line | 8217 The invariant that each normative paragraph is associated with a line |
8215 containing the text \LMHash{} should be maintained. Extra occurrences | 8218 containing the text \LMHash{} should be maintained. Extra occurrences |
8216 of \LMHash{} can be added if needed, e.g., in order to make | 8219 of \LMHash{} can be added if needed, e.g., in order to make |
8217 individual \item{}s in itemized lists addressable. Each \LM.. command | 8220 individual \item{}s in itemized lists addressable. Each \LM.. command |
8218 must occur on a separate line. \LMHash{} must occur immediately | 8221 must occur on a separate line. \LMHash{} must occur immediately |
8219 before the associated paragraph, and \LMLabel must occur immediately | 8222 before the associated paragraph, and \LMLabel must occur immediately |
8220 after the associated \section{}, \subsection{} etc. | 8223 after the associated \section{}, \subsection{} etc. |
8221 | 8224 |
8222 ---------------------------------------------------------------------- | 8225 ---------------------------------------------------------------------- |
OLD | NEW |