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

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

Issue 2975283002: Fixed language specification typos. (Closed)
Patch Set: More typos from other sources Created 3 years, 5 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 610 matching lines...) Expand 10 before | Expand all | Expand 10 after
621 Because Dart is optionally typed, we cannot guarantee that a function that does not return a value will not be used in the context of an expression. Therefore, every function must return a value. A function body that ends without doing a th row or return will cause the function to return \NULL{}, as will a \RETURN{} wit hout an expression. For generator functions, the situation is more subtle. See f urther discussion in section \ref{return}. 621 Because Dart is optionally typed, we cannot guarantee that a function that does not return a value will not be used in the context of an expression. Therefore, every function must return a value. A function body that ends without doing a th row or return will cause the function to return \NULL{}, as will a \RETURN{} wit hout an expression. For generator functions, the situation is more subtle. See f urther discussion in section \ref{return}.
622 } 622 }
623 623
624 OR 624 OR
625 \item of the form \code{=> $e$} or the form \code{\ASYNC{} => $e$}, which both r eturn the value of the expression $e$ as if by a \code{return $e$}. \commentary{ The other modifiers do not apply here, because they apply only to generators, di scussed below, and generators do not allow to return a value, values are added t o the generated stream or iterable using \YIELD{} instead.} 625 \item of the form \code{=> $e$} or the form \code{\ASYNC{} => $e$}, which both r eturn the value of the expression $e$ as if by a \code{return $e$}. \commentary{ The other modifiers do not apply here, because they apply only to generators, di scussed below, and generators do not allow to return a value, values are added t o the generated stream or iterable using \YIELD{} instead.}
626 Let $R$ be the static type of $e$ 626 Let $R$ be the static type of $e$
627 and let $T$ be the actual return type (\ref{actualTypeOfADeclaration}) 627 and let $T$ be the actual return type (\ref{actualTypeOfADeclaration})
628 of the function that has this body. 628 of the function that has this body.
629 It is a static warning if $T$ is not \VOID{} and either 629 It is a static warning if $T$ is not \VOID{} and either
630 the function is synchronous and the static type of $R$ is not assignable to $T$, 630 the function is synchronous and the static type of $R$ is not assignable to $T$,
631 or the function is asynchronous and \code{Future<$flatten${$R$}>} 631 or the function is asynchronous and \code{Future<$flatten$($R$)>}
632 is not assignable to $T$. 632 is not assignable to $T$.
633 633
634 \end{itemize} 634 \end{itemize}
635 635
636 \LMHash{} 636 \LMHash{}
637 A function is {\em asynchronous} if its body is marked with the \ASYNC{} or \ASY NC* modifier. Otherwise the function is {\em synchronous}. A function is a {\em generator} if its body is marked with the \SYNC* or \ASYNC* modifier. 637 A function is {\em asynchronous} if its body is marked with the \ASYNC{} or \ASY NC* modifier. Otherwise the function is {\em synchronous}. A function is a {\em generator} if its body is marked with the \SYNC* or \ASYNC* modifier.
638 638
639 \commentary{ 639 \commentary{
640 Whether a function is synchronous or asynchronous is orthogonal to whether it is a generator or not. Generator functions are a sugar for functions that produce collections in a systematic way, by lazily applying a function that {\em generat es} individual elements of a collection. Dart provides such a sugar in both the synchronous case, where one returns an iterable, and in the asynchronous case, w here one returns a stream. Dart also allows both synchronous and asynchronous fu nctions that produce a single value. 640 Whether a function is synchronous or asynchronous is orthogonal to whether it is a generator or not. Generator functions are a sugar for functions that produce collections in a systematic way, by lazily applying a function that {\em generat es} individual elements of a collection. Dart provides such a sugar in both the synchronous case, where one returns an iterable, and in the asynchronous case, w here one returns a stream. Dart also allows both synchronous and asynchronous fu nctions that produce a single value.
641 } 641 }
(...skipping 2566 matching lines...) Expand 10 before | Expand all | Expand 10 after
3208 3208
3209 \LMHash{} 3209 \LMHash{}
3210 A map literal is ordered: iterating over the keys and/or values of the maps alwa ys happens in the 3210 A map literal is ordered: iterating over the keys and/or values of the maps alwa ys happens in the
3211 order the keys appeared in the source code. 3211 order the keys appeared in the source code.
3212 3212
3213 \commentary{ 3213 \commentary{
3214 Of course, if a key repeats, the order is defined by first occurrence, but the v alue is defined by the last. 3214 Of course, if a key repeats, the order is defined by first occurrence, but the v alue is defined by the last.
3215 } 3215 }
3216 3216
3217 \LMHash{} 3217 \LMHash{}
3218 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{}>$. 3218 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>$.
3219 The static type of 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{}>$.
3219 3220
3220 3221
3221 \subsection{Throw} 3222 \subsection{Throw}
3222 \LMLabel{throw} 3223 \LMLabel{throw}
3223 3224
3224 \LMHash{} 3225 \LMHash{}
3225 The {\em throw expression} is used to throw an exception. 3226 The {\em throw expression} is used to throw an exception.
3226 3227
3227 \begin{grammar} 3228 \begin{grammar}
3228 {\bf throwExpression:} 3229 {\bf throwExpression:}
3229 \THROW{} expression 3230 \THROW{} expression
3230 . 3231 .
3231 3232
3232 {\bf throwExpressionWithoutCascade:} 3233 {\bf throwExpressionWithoutCascade:}
3233 \THROW{} expressionWithoutCascade 3234 \THROW{} expressionWithoutCascade
3234 . 3235 .
3235 3236
3236 \end{grammar} 3237 \end{grammar}
3237 3238
3238 \LMHash{} 3239 \LMHash{}
3239 Evaluation of a throw expression of the form \code{\THROW{} $e$;} proceeds as f ollows: 3240 Evaluation of a throw expression of the form \code{\THROW{} $e$;} proceeds as f ollows:
3240 3241
3241 \LMHash{} 3242 \LMHash{}
3242 The expression $e$ is evaluated to a value $v$ (\ref{evaluation}). 3243 The expression $e$ is evaluated to a value $v$ (\ref{evaluation}).
3243 3244
3244 \commentary{ 3245 \commentary{
3245 There is no requirement that the expression $e$ evaluate to any special kind of object. 3246 There is no requirement that the expression $e$ must evaluate to any special kin d of object.
3246 } 3247 }
3247 3248
3248 \LMHash{} 3249 \LMHash{}
3249 If $v$ is the null value (\ref{null}), then a \code{NullThrownError} is thrown. 3250 If $v$ is the null value (\ref{null}), then a \code{NullThrownError} is thrown.
3250 Otherwise let $t$ be a stack trace corresponding to the current execution state, 3251 Otherwise let $t$ be a stack trace corresponding to the current execution state,
3251 and the \THROW{} statement throws with $v$ as exception object 3252 and the \THROW{} statement throws with $v$ as exception object
3252 and $t$ as stack trace (\ref{evaluation}). 3253 and $t$ as stack trace (\ref{evaluation}).
3253 3254
3254 \LMHash{} 3255 \LMHash{}
3255 If $v$ is an instance of class \code{Error} or a subclass thereof, 3256 If $v$ is an instance of class \code{Error} or a subclass thereof,
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
3307 This ensures that $Future<S>$ is the most specific instantiation of \cd{Future} that is a super type of $T$. 3308 This ensures that $Future<S>$ is the most specific instantiation of \cd{Future} that is a super type of $T$.
3308 } 3309 }
3309 3310
3310 Then $flatten(T) = S$. 3311 Then $flatten(T) = S$.
3311 3312
3312 In any other circumstance, $flatten(T) = T$. 3313 In any other circumstance, $flatten(T) = T$.
3313 3314
3314 3315
3315 3316
3316 \rationale{ 3317 \rationale{
3317 We collapse multiple layers of futures into one. If $e$ evaluates to a future $f $, the future will not invoke its \code{then()} callback until f completes to a non-future value, and so the result of an await is never a future, and the resul t of an async function will never have type \code{Future$<X>$} where $X$ itself is an invocation of \code{Future}. 3318 We collapse multiple layers of futures into one. If $e$ evaluates to a future $f $, the future will not invoke its \code{then()} callback until f completes to a non-future value, and so the result of an await is never a future, and the resul t of an \ASYNC{} function will never have type \code{Future$<X>$} where $X$ itse lf is an invocation of \code{Future}.
3318 3319
3319 The exception to that would be a type $X$ that extended or implemented \code{Fu ture}. In that case, only one unwrapping takes place. As an example of why this is done, consider 3320 The exception to that would be a type $X$ that extended or implemented \code{Fu ture}. In that case, only one unwrapping takes place. As an example of why this is done, consider
3320 3321
3321 \cd{\CLASS{} C<T> \IMPLEMENTS{} Future<C<C<T>>> \ldots } 3322 \cd{\CLASS{} C<T> \IMPLEMENTS{} Future<C<C<T>>> \ldots }
3322 3323
3323 Here, a naive definition of $flatten$ diverges; there is not even a fixed point. A more sophisticated definition of $flatten$ is possible, but the existing rule deals with most realistic examples while remaining relatively simple to underst and. 3324 Here, a naive definition of $flatten$ diverges; there is not even a fixed point. A more sophisticated definition of $flatten$ is possible, but the existing rule deals with most realistic examples while remaining relatively simple to underst and.
3324 3325
3325 } 3326 }
3326 3327
3327 3328
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
3723 3724
3724 3725
3725 \subsection{ Function Invocation} 3726 \subsection{ Function Invocation}
3726 \LMLabel{functionInvocation} 3727 \LMLabel{functionInvocation}
3727 3728
3728 \LMHash{} 3729 \LMHash{}
3729 Function invocation occurs in the following cases: when a function expression ( \ref{functionExpressions}) is invoked (\ref{functionExpressionInvocation}), when a method (\ref{methodInvocation}), getter (\ref{topLevelGetterInvocation}, \ref {propertyExtraction}) or setter (\ref{assignment}) is invoked or when a construc tor is invoked (either via instance creation (\ref{instanceCreation}), construct or redirection (\ref{redirectingConstructors}) or super initialization). The var ious kinds of function invocation differ as to how the function to be invoked, $ f$, is determined, as well as whether \THIS{} (\ref{this}) is bound. Once $f$ h as been determined, the formal parameters of $f$ are bound to corresponding actu al arguments. When the body of $f$ is executed it will be executed with the afor ementioned bindings. 3730 Function invocation occurs in the following cases: when a function expression ( \ref{functionExpressions}) is invoked (\ref{functionExpressionInvocation}), when a method (\ref{methodInvocation}), getter (\ref{topLevelGetterInvocation}, \ref {propertyExtraction}) or setter (\ref{assignment}) is invoked or when a construc tor is invoked (either via instance creation (\ref{instanceCreation}), construct or redirection (\ref{redirectingConstructors}) or super initialization). The var ious kinds of function invocation differ as to how the function to be invoked, $ f$, is determined, as well as whether \THIS{} (\ref{this}) is bound. Once $f$ h as been determined, the formal parameters of $f$ are bound to corresponding actu al arguments. When the body of $f$ is executed it will be executed with the afor ementioned bindings.
3730 3731
3731 \LMHash{} 3732 \LMHash{}
3732 Executing a body of the form \code{=> $e$} is equivalent to executing a body of the form \code{\{ return $e$; \}}. 3733 Executing a body of the form \code{=> $e$} is equivalent to executing a body of the form \code{\{ return $e$; \}}.
3733 Execution a body of the form \code{async => $e$} is equivalent to executing a bo dy of the form \code{async \{ return $e$; \}}. 3734 Execution a body of the form \code{\ASYNC{} => $e$} is equivalent to executing a body of the form \code{\ASYNC{} \{ return $e$; \}}.
3734 3735
3735 \LMHash{} 3736 \LMHash{}
3736 If $f$ is synchronous and is not a generator (\ref{functions}) then execution of the body of $f$ begins immediately. 3737 If $f$ is synchronous and is not a generator (\ref{functions}) then execution of the body of $f$ begins immediately.
3737 If the execution of the body of $f$ returns a value, $v$, (\ref{completion}), th e invocation evaluates to $v$. 3738 If the execution of the body of $f$ returns a value, $v$, (\ref{completion}), th e invocation evaluates to $v$.
3738 If the execution completes normally or it returns without a value, the invocatio n evaluates to \NULL (\ref{null}). 3739 If the execution completes normally or it returns without a value, the invocatio n evaluates to \NULL (\ref{null}).
3739 If the execution throws an exception object and stack trace, the invocation thro ws the same exception object and stack trace (\ref{evaluation}). 3740 If the execution throws an exception object and stack trace, the invocation thro ws the same exception object and stack trace (\ref{evaluation}).
3740 3741
3741 \commentary{ 3742 \commentary{
3742 A complete function body can never break or contine (\ref{completion}) 3743 A complete function body can never break or contine (\ref{completion})
3743 because a \BREAK{} or \CONTINUE{} statement must always occur inside the stateme nt that is the target of the \BREAK{} or \CONTINUE{}. 3744 because a \BREAK{} or \CONTINUE{} statement must always occur inside the stateme nt that is the target of the \BREAK{} or \CONTINUE{}.
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
4105 \end{code} 4106 \end{code}
4106 4107
4107 \commentary{Notice that the wording carefully avoids re-evaluating the receiver $o$ and the arguments $a_i$. } 4108 \commentary{Notice that the wording carefully avoids re-evaluating the receiver $o$ and the arguments $a_i$. }
4108 4109
4109 \LMHash{} 4110 \LMHash{}
4110 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: 4111 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:
4111 \begin{itemize} 4112 \begin{itemize}
4112 \item 4113 \item
4113 $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 4114 $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
4114 \item $T$ is \code{Type}, $e$ is a constant type literal and the class correspo nding to $e$ has a static getter named $m$. 4115 \item $T$ is \code{Type}, $e$ is a constant type literal and the class correspo nding to $e$ has a static getter named $m$.
4115 \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. 4116 \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.
4116 } 4117 }
4117 \end{itemize} 4118 \end{itemize}
4118 4119
4119 \LMHash{} 4120 \LMHash{}
4120 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$. 4121 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$.
4121 4122
4122 \LMHash{} 4123 \LMHash{}
4123 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 `.'. 4124 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 `.'.
4124 4125
4125 4126
(...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after
4776 4777
4777 4778
4778 \LMHash{} 4779 \LMHash{}
4779 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$. 4780 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$.
4780 4781
4781 4782
4782 \subsection{If-null Expressions} 4783 \subsection{If-null Expressions}
4783 \label{ifNull} 4784 \label{ifNull}
4784 4785
4785 \LMHash{} 4786 \LMHash{}
4786 An {\em if-null expression}evaluates an expression and if the result is \NULL, evaluates another. 4787 An {\em if-null expression} evaluates an expression and if the result is \NULL, evaluates another.
4787 4788
4788 \begin{grammar} 4789 \begin{grammar}
4789 {\bf ifNullExpression:} 4790 {\bf ifNullExpression:}
4790 logicalOrExpression (`??' logicalOrExpression)* 4791 logicalOrExpression (`??' logicalOrExpression)*
4791 \end{grammar} 4792 \end{grammar}
4792 4793
4793 \LMHash{} 4794 \LMHash{}
4794 Evaluation of an if-null expression $e$ of the form \code{$e_1$ ?? $e_2$} 4795 Evaluation of an if-null expression $e$ of the form \code{$e_1$ ?? $e_2$}
4795 proceeds as follows: 4796 proceeds as follows:
4796 4797
(...skipping 1702 matching lines...) Expand 10 before | Expand all | Expand 10 after
6499 } 6500 }
6500 6501
6501 \LMHash{} 6502 \LMHash{}
6502 It is a compile-time error if a return statement of the form \code{\RETURN{} $e$ ;} appears in a generator function. 6503 It is a compile-time error if a return statement of the form \code{\RETURN{} $e$ ;} appears in a generator function.
6503 6504
6504 \rationale{ 6505 \rationale{
6505 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. 6506 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.
6506 } 6507 }
6507 6508
6508 \LMHash{} 6509 \LMHash{}
6509 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: 6510 Let $f$ be the function immediately enclosing a return statement of the form \RE TURN{};.
6511 It is a static warning if $f$ is neither a generator nor a generative constructo r and either:
6510 \begin{itemize} 6512 \begin{itemize}
6511 \item $f$ is synchronous and the return type of $f$ may not be assigned to \VOI D{} (\ref{typeVoid}) or, 6513 \item $f$ is synchronous and the return type of $f$ may not be assigned to \VOI D{} (\ref{typeVoid}) or,
6512 \item $f$ is asynchronous and the return type of $f$ may not be assigned to \co de{Future<Null>}. 6514 \item $f$ is asynchronous and the return type of $f$ may not be assigned to \co de{Future<Null>}.
6513 \end{itemize} 6515 \end{itemize}
6514 6516
6515 \commentary{ 6517 \commentary{
6516 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. 6518 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.
6517 } 6519 }
6518 \rationale{This helps catch situations where users forget to return a value in a return statement.} 6520 \rationale{This helps catch situations where users forget to return a value in a return statement.}
6519 6521
(...skipping 922 matching lines...) Expand 10 before | Expand all | Expand 10 after
7442 7444
7443 \begin{dartCode} 7445 \begin{dartCode}
7444 \VAR{} i; 7446 \VAR{} i;
7445 i j; // a variable j of type i (supposedly) 7447 i j; // a variable j of type i (supposedly)
7446 main() \{ 7448 main() \{
7447 j = 'I am not an i'; 7449 j = 'I am not an i';
7448 \} 7450 \}
7449 \end{dartCode} 7451 \end{dartCode}
7450 7452
7451 \commentary{ 7453 \commentary{
7452 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. 7454 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.
7453 } 7455 }
7454 7456
7455 7457
7456 \commentary{ 7458 \commentary{
7457 Here is an example involving malbounded types: 7459 Here is an example involving malbounded types:
7458 } 7460 }
7459 7461
7460 \begin{dartCode} 7462 \begin{dartCode}
7461 \CLASS{} I<T \EXTENDS{} num> \{\} 7463 \CLASS{} I<T \EXTENDS{} num> \{\}
7462 \CLASS{} J \{\} 7464 \CLASS{} J \{\}
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
7829 7831
7830 7832
7831 7833
7832 \subsection{Parameterized Types} 7834 \subsection{Parameterized Types}
7833 \LMLabel{parameterizedTypes} 7835 \LMLabel{parameterizedTypes}
7834 7836
7835 \LMHash{} 7837 \LMHash{}
7836 A {\em parameterized type} is an invocation of a generic type declaration. 7838 A {\em parameterized type} is an invocation of a generic type declaration.
7837 7839
7838 \LMHash{} 7840 \LMHash{}
7839 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{}. 7841 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{}.
7840 7842
7841 \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. 7843 \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.
7842 } 7844 }
7843 7845
7844 \LMHash{} 7846 \LMHash{}
7845 Otherwise, let 7847 Otherwise, let
7846 $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$. 7848 $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$.
7847 7849
7848 \commentary{ 7850 \commentary{
7849 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}. 7851 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
8235 8237
8236 The invariant that each normative paragraph is associated with a line 8238 The invariant that each normative paragraph is associated with a line
8237 containing the text \LMHash{} should be maintained. Extra occurrences 8239 containing the text \LMHash{} should be maintained. Extra occurrences
8238 of \LMHash{} can be added if needed, e.g., in order to make 8240 of \LMHash{} can be added if needed, e.g., in order to make
8239 individual \item{}s in itemized lists addressable. Each \LM.. command 8241 individual \item{}s in itemized lists addressable. Each \LM.. command
8240 must occur on a separate line. \LMHash{} must occur immediately 8242 must occur on a separate line. \LMHash{} must occur immediately
8241 before the associated paragraph, and \LMLabel must occur immediately 8243 before the associated paragraph, and \LMLabel must occur immediately
8242 after the associated \section{}, \subsection{} etc. 8244 after the associated \section{}, \subsection{} etc.
8243 8245
8244 ---------------------------------------------------------------------- 8246 ----------------------------------------------------------------------
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