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

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

Issue 2844003002: Fix few typos in the language specification. (Closed)
Patch Set: Created 3 years, 8 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 \\
(...skipping 3176 matching lines...) Expand 10 before | Expand all | Expand 10 after
3187 3187
3188 \LMHash{} 3188 \LMHash{}
3189 A map literal is ordered: iterating over the keys and/or values of the maps alwa ys happens in the 3189 A map literal is ordered: iterating over the keys and/or values of the maps alwa ys happens in the
3190 order the keys appeared in the source code. 3190 order the keys appeared in the source code.
3191 3191
3192 \commentary{ 3192 \commentary{
3193 Of course, if a key repeats, the order is defined by first occurrence, but the v alue is defined by the last. 3193 Of course, if a key repeats, the order is defined by first occurrence, but the v alue is defined by the last.
3194 } 3194 }
3195 3195
3196 \LMHash{} 3196 \LMHash{}
3197 The static type of a map literal of the form \CONST{}$ <K, V>\{k_1:e_1\ldots k_ n :e_n\}$ or the form $<K, V>\{k_1:e_1\ldots k_n :e_n\}$ is $Map<K, V>$. The sta tic type a map literal of the form \CONST{}$\{k_1:e_1\ldots k_n :e_n\}$ or the form $\{k_1:e_1\ldots k_n :e_n\}$ is $Map<\DYNAMIC{}, \DYNAMIC{}>$. 3197 The static type of a map literal of the form \CONST{}$ <K, V>\{k_1:e_1\ldots k_ n :e_n\}$ or the form $<K, V>\{k_1:e_1\ldots k_n :e_n\}$ is $Map<K, V>$. The sta tic type of a map literal of the form \CONST{}$\{k_1:e_1\ldots k_n :e_n\}$ or t he form $\{k_1:e_1\ldots k_n :e_n\}$ is $Map<\DYNAMIC{}, \DYNAMIC{}>$.
3198 3198
3199 3199
3200 \subsection{Throw} 3200 \subsection{Throw}
3201 \LMLabel{throw} 3201 \LMLabel{throw}
3202 3202
3203 \LMHash{} 3203 \LMHash{}
3204 The {\em throw expression} is used to throw an exception. 3204 The {\em throw expression} is used to throw an exception.
3205 3205
3206 \begin{grammar} 3206 \begin{grammar}
3207 {\bf throwExpression:} 3207 {\bf throwExpression:}
3208 \THROW{} expression 3208 \THROW{} expression
3209 . 3209 .
3210 3210
3211 {\bf throwExpressionWithoutCascade:} 3211 {\bf throwExpressionWithoutCascade:}
3212 \THROW{} expressionWithoutCascade 3212 \THROW{} expressionWithoutCascade
3213 . 3213 .
3214 3214
3215 \end{grammar} 3215 \end{grammar}
3216 3216
3217 \LMHash{} 3217 \LMHash{}
3218 Evaluation of a throw expression of the form \code{\THROW{} $e$;} proceeds as f ollows: 3218 Evaluation of a throw expression of the form \code{\THROW{} $e$;} proceeds as f ollows:
3219 3219
3220 \LMHash{} 3220 \LMHash{}
3221 The expression $e$ is evaluated to a value $v$ (\ref{evaluation}). 3221 The expression $e$ is evaluated to a value $v$ (\ref{evaluation}).
3222 3222
3223 \commentary{ 3223 \commentary{
3224 There is no requirement that the expression $e$ evaluate to any special kind of object. 3224 There is no requirement that the expression $e$ evaluates to any special kind of object.
3225 } 3225 }
3226 3226
3227 \LMHash{} 3227 \LMHash{}
3228 If $v$ is the null value (\ref{null}), then a \code{NullThrownError} is thrown. 3228 If $v$ is the null value (\ref{null}), then a \code{NullThrownError} is thrown.
3229 Otherwise let $t$ be a stack trace corresponding to the current execution state, 3229 Otherwise let $t$ be a stack trace corresponding to the current execution state,
3230 and the \THROW{} statement throws with $v$ as exception object 3230 and the \THROW{} statement throws with $v$ as exception object
3231 and $t$ as stack trace (\ref{evaluation}). 3231 and $t$ as stack trace (\ref{evaluation}).
3232 3232
3233 \LMHash{} 3233 \LMHash{}
3234 If $v$ is an instance of class \code{Error} or a subclass thereof, 3234 If $v$ is an instance of class \code{Error} or a subclass thereof,
(...skipping 845 matching lines...) Expand 10 before | Expand all | Expand 10 after
4080 \end{code} 4080 \end{code}
4081 4081
4082 \commentary{Notice that the wording carefully avoids re-evaluating the receiver $o$ and the arguments $a_i$. } 4082 \commentary{Notice that the wording carefully avoids re-evaluating the receiver $o$ and the arguments $a_i$. }
4083 4083
4084 \LMHash{} 4084 \LMHash{}
4085 Let $T$ be the static type of $o$. It is a static type warning if $T$ does not have an accessible (\ref{privacy}) instance member named $m$ unless either: 4085 Let $T$ be the static type of $o$. It is a static type warning if $T$ does not have an accessible (\ref{privacy}) instance member named $m$ unless either:
4086 \begin{itemize} 4086 \begin{itemize}
4087 \item 4087 \item
4088 $T$ or a superinterface of $T$ is annotated with an annotation denoting a consta nt identical to the constant \code{@proxy} defined in \code{dart:core}. Or 4088 $T$ or a superinterface of $T$ is annotated with an annotation denoting a consta nt identical to the constant \code{@proxy} defined in \code{dart:core}. Or
4089 \item $T$ is \code{Type}, $e$ is a constant type literal and the class correspo nding to $e$ has a static getter named $m$. 4089 \item $T$ is \code{Type}, $e$ is a constant type literal and the class correspo nding to $e$ has a static getter named $m$.
4090 \item $T$ is \code{Function} and $m$ is \CALL. \rationale {The type \code{Functi on} is treated as if it has a \code{call} method for any possible signature of \ CALL. The expectation is that any concrete subclass of \code{Function} will impl ement \CALL. Note that a warning will be issue if this is not the case. Furtherm ore, any use of \CALL{} on a subclass of \code{Function} that fails to implement \CALL{} will also provoke a warning, as this exemption is limited to type \code {Function}, and does not apply to its subtypes. 4090 \item $T$ is \code{Function} and $m$ is \CALL. \rationale {The type \code{Functi on} is treated as if it has a \code{call} method for any possible signature of \ CALL. The expectation is that any concrete subclass of \code{Function} will impl ement \CALL. Note that a warning will be issued if this is not the case. Further more, any use of \CALL{} on a subclass of \code{Function} that fails to implemen t \CALL{} will also provoke a warning, as this exemption is limited to type \cod e{Function}, and does not apply to its subtypes.
4091 } 4091 }
4092 \end{itemize} 4092 \end{itemize}
4093 4093
4094 \LMHash{} 4094 \LMHash{}
4095 If $T.m$ exists, it is a static type warning if the type $F$ of $T.m$ may not b e assigned to a function type. If $T.m$ does not exist, or if $F$ is not a funct ion type, the static type of $i$ is \DYNAMIC{}; otherwise the static type of $i$ is the declared return type of $F$. 4095 If $T.m$ exists, it is a static type warning if the type $F$ of $T.m$ may not b e assigned to a function type. If $T.m$ does not exist, or if $F$ is not a funct ion type, the static type of $i$ is \DYNAMIC{}; otherwise the static type of $i$ is the declared return type of $F$.
4096 4096
4097 \LMHash{} 4097 \LMHash{}
4098 It is a compile-time error to invoke any of the methods of class \cd{Object} on a prefix object (\ref{imports}) or on a constant type literal that is immediate ly followed by the token `.'. 4098 It is a compile-time error to invoke any of the methods of class \cd{Object} on a prefix object (\ref{imports}) or on a constant type literal that is immediate ly followed by the token `.'.
4099 4099
4100 4100
(...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after
4751 4751
4752 4752
4753 \LMHash{} 4753 \LMHash{}
4754 It is a static type warning if the static type of $e_1$ may not be assigned to \code{bool}. The static type of $c$ is the least upper bound (\ref{leastUpperBo unds}) of the static type of $e_2$ and the static type of $e_3$. 4754 It is a static type warning if the static type of $e_1$ may not be assigned to \code{bool}. The static type of $c$ is the least upper bound (\ref{leastUpperBo unds}) of the static type of $e_2$ and the static type of $e_3$.
4755 4755
4756 4756
4757 \subsection{If-null Expressions} 4757 \subsection{If-null Expressions}
4758 \label{ifNull} 4758 \label{ifNull}
4759 4759
4760 \LMHash{} 4760 \LMHash{}
4761 An {\em if-null expression}evaluates an expression and if the result is \NULL, evaluates another. 4761 An {\em if-null expression} evaluates an expression and if the result is \NULL, evaluates another.
4762 4762
4763 \begin{grammar} 4763 \begin{grammar}
4764 {\bf ifNullExpression:} 4764 {\bf ifNullExpression:}
4765 logicalOrExpression (`??' logicalOrExpression)* 4765 logicalOrExpression (`??' logicalOrExpression)*
4766 \end{grammar} 4766 \end{grammar}
4767 4767
4768 \LMHash{} 4768 \LMHash{}
4769 Evaluation of an if-null expression $e$ of the form \code{$e_1$ ?? $e_2$} 4769 Evaluation of an if-null expression $e$ of the form \code{$e_1$ ?? $e_2$}
4770 proceeds as follows: 4770 proceeds as follows:
4771 4771
(...skipping 1693 matching lines...) Expand 10 before | Expand all | Expand 10 after
6465 } 6465 }
6466 6466
6467 \LMHash{} 6467 \LMHash{}
6468 It is a compile-time error if a return statement of the form \code{\RETURN{} $e$ ;} appears in a generator function. 6468 It is a compile-time error if a return statement of the form \code{\RETURN{} $e$ ;} appears in a generator function.
6469 6469
6470 \rationale{ 6470 \rationale{
6471 In the case of a generator function, the value returned by the function is the i terable or stream associated with it, and individual elements are added to that iterable using yield statements, and so returning a value makes no sense. 6471 In the case of a generator function, the value returned by the function is the i terable or stream associated with it, and individual elements are added to that iterable using yield statements, and so returning a value makes no sense.
6472 } 6472 }
6473 6473
6474 \LMHash{} 6474 \LMHash{}
6475 Let $f$ be the function immediately enclosing a return statement of the form \RE TURN{}; It is a static warning $f$ is neither a generator nor a generative cons tructor and either: 6475 Let $f$ be the function immediately enclosing a return statement of the form \RE TURN{}; It is a static warning if $f$ is neither a generator nor a generative co nstructor and either:
6476 \begin{itemize} 6476 \begin{itemize}
6477 \item $f$ is synchronous and the return type of $f$ may not be assigned to \VOI D{} (\ref{typeVoid}) or, 6477 \item $f$ is synchronous and the return type of $f$ may not be assigned to \VOI D{} (\ref{typeVoid}) or,
6478 \item $f$ is asynchronous and the return type of $f$ may not be assigned to \co de{Future<Null>}. 6478 \item $f$ is asynchronous and the return type of $f$ may not be assigned to \co de{Future<Null>}.
6479 \end{itemize} 6479 \end{itemize}
6480 6480
6481 \commentary{ 6481 \commentary{
6482 Hence, a static warning will not be issued if $f$ has no declared return type, s ince the return type would be \DYNAMIC{} and \DYNAMIC{} may be assigned to \VO ID{} and to \code{Future<Null>}. However, any synchronous non-generator function that declares a return type must return an expression explicitly. 6482 Hence, a static warning will not be issued if $f$ has no declared return type, s ince the return type would be \DYNAMIC{} and \DYNAMIC{} may be assigned to \VO ID{} and to \code{Future<Null>}. However, any synchronous non-generator function that declares a return type must return an expression explicitly.
6483 } 6483 }
6484 \rationale{This helps catch situations where users forget to return a value in a return statement.} 6484 \rationale{This helps catch situations where users forget to return a value in a return statement.}
6485 6485
(...skipping 870 matching lines...) Expand 10 before | Expand all | Expand 10 after
7356 7356
7357 \begin{dartCode} 7357 \begin{dartCode}
7358 \VAR{} i; 7358 \VAR{} i;
7359 i j; // a variable j of type i (supposedly) 7359 i j; // a variable j of type i (supposedly)
7360 main() \{ 7360 main() \{
7361 j = 'I am not an i'; 7361 j = 'I am not an i';
7362 \} 7362 \}
7363 \end{dartCode} 7363 \end{dartCode}
7364 7364
7365 \commentary{ 7365 \commentary{
7366 Since $i$ is not a type, a static warning will be issue at the declaration of $j $. However, the program can be executed without incident in production mode beca use he undeclared type $i$ is treated as \DYNAMIC{}. However, in checked mode, t he implicit subtype test at the assignment will trigger an error at runtime. 7366 Since $i$ is not a type, a static warning will be issue at the declaration of $j $. However, the program can be executed without incident in production mode beca use the undeclared type $i$ is treated as \DYNAMIC{}. However, in checked mode, the implicit subtype test at the assignment will trigger an error at runtime.
7367 } 7367 }
7368 7368
7369 7369
7370 \commentary{ 7370 \commentary{
7371 Here is an example involving malbounded types: 7371 Here is an example involving malbounded types:
7372 } 7372 }
7373 7373
7374 \begin{dartCode} 7374 \begin{dartCode}
7375 \CLASS{} I<T \EXTENDS{} num> \{\} 7375 \CLASS{} I<T \EXTENDS{} num> \{\}
7376 \CLASS{} J \{\} 7376 \CLASS{} J \{\}
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
7741 7741
7742 7742
7743 7743
7744 \subsection{Parameterized Types} 7744 \subsection{Parameterized Types}
7745 \LMLabel{parameterizedTypes} 7745 \LMLabel{parameterizedTypes}
7746 7746
7747 \LMHash{} 7747 \LMHash{}
7748 A {\em parameterized type} is an invocation of a generic type declaration. 7748 A {\em parameterized type} is an invocation of a generic type declaration.
7749 7749
7750 \LMHash{} 7750 \LMHash{}
7751 Let $T$ be a parameterized type $G<S_1, \ldots, S_n>$. If $G$ is not a generic type, the type arguments $S_i$, $1 \le i \le n$ are discarded. If $G$ has $m \n e n$ type parameters, $T$ is treated as as a parameterized type with $m$ argumen ts, all of which are \DYNAMIC{}. 7751 Let $T$ be a parameterized type $G<S_1, \ldots, S_n>$. If $G$ is not a generic type, the type arguments $S_i$, $1 \le i \le n$ are discarded. If $G$ has $m \n e n$ type parameters, $T$ is treated as a parameterized type with $m$ arguments, all of which are \DYNAMIC{}.
7752 7752
7753 \commentary{In short, any arity mismatch results in all type arguments being dro pped, and replaced with the correct number of type arguments, all set to \DYNAMI C{}. Of course, a static warning will be issued. 7753 \commentary{In short, any arity mismatch results in all type arguments being dro pped, and replaced with the correct number of type arguments, all set to \DYNAMI C{}. Of course, a static warning will be issued.
7754 } 7754 }
7755 7755
7756 \LMHash{} 7756 \LMHash{}
7757 Otherwise, let 7757 Otherwise, let
7758 $T_i$ be the type parameters of $G$ and let $B_i$ be the bound of $T_i, i \in 1.. n$,. $T$ is {\em malbounded} iff either $S_i$ is malbounded or $S_i$ is not a subtype of $[S_1, \ldots, S_n/T_1, \ldots, T_n]B_i, i \in 1.. n$. 7758 $T_i$ be the type parameters of $G$ and let $B_i$ be the bound of $T_i, i \in 1.. n$,. $T$ is {\em malbounded} iff either $S_i$ is malbounded or $S_i$ is not a subtype of $[S_1, \ldots, S_n/T_1, \ldots, T_n]B_i, i \in 1.. n$.
7759 7759
7760 \commentary{ 7760 \commentary{
7761 Note, that, in checked mode, it is a dynamic type error if a malbounded type is used in a type test as specified in \ref{dynamicTypeSystem}. 7761 Note, that, in checked mode, it is a dynamic type error if a malbounded type is used in a type test as specified in \ref{dynamicTypeSystem}.
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
8147 8147
8148 The invariant that each normative paragraph is associated with a line 8148 The invariant that each normative paragraph is associated with a line
8149 containing the text \LMHash{} should be maintained. Extra occurrences 8149 containing the text \LMHash{} should be maintained. Extra occurrences
8150 of \LMHash{} can be added if needed, e.g., in order to make 8150 of \LMHash{} can be added if needed, e.g., in order to make
8151 individual \item{}s in itemized lists addressable. Each \LM.. command 8151 individual \item{}s in itemized lists addressable. Each \LM.. command
8152 must occur on a separate line. \LMHash{} must occur immediately 8152 must occur on a separate line. \LMHash{} must occur immediately
8153 before the associated paragraph, and \LMLabel must occur immediately 8153 before the associated paragraph, and \LMLabel must occur immediately
8154 after the associated \section{}, \subsection{} etc. 8154 after the associated \section{}, \subsection{} etc.
8155 8155
8156 ---------------------------------------------------------------------- 8156 ----------------------------------------------------------------------
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