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 {4th edition draft}\\ | 10 {4th edition draft}\\ |
(...skipping 858 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
869 | 869 |
870 {\bf staticFinalDeclaration:} | 870 {\bf staticFinalDeclaration:} |
871 identifier `=' expression | 871 identifier `=' expression |
872 . | 872 . |
873 | 873 |
874 \end{grammar} | 874 \end{grammar} |
875 | 875 |
876 \LMHash{} | 876 \LMHash{} |
877 A class has constructors, instance members and static members. The instance mem bers of a class are its instance methods, getters, setters and instance variable s. The static members of a class are its static methods, getters, setters and st atic variables. The members of a class are its static and instance members. | 877 A class has constructors, instance members and static members. The instance mem bers of a class are its instance methods, getters, setters and instance variable s. The static members of a class are its static methods, getters, setters and st atic variables. The members of a class are its static and instance members. |
878 | 878 |
879 \LMHash{} | |
879 A class has several scopes: | 880 A class has several scopes: |
880 \begin{itemize} | 881 \begin{itemize} |
881 \item A {\em type-parameter scope}, which is empty if the class is not generic ( \ref{generics}). The enclosing scope of the type-parameter scope of a class is the enclosing scope of the class declaration. | 882 \item A {\em type-parameter scope}, which is empty if the class is not generic ( \ref{generics}). The enclosing scope of the type-parameter scope of a class is the enclosing scope of the class declaration. |
882 \item A {\em static scope}. The enclosing scope of the static scope of a class is the type parameter scope (\ref{generics}) of the class. | 883 \item A {\em static scope}. The enclosing scope of the static scope of a class is the type parameter scope (\ref{generics}) of the class. |
883 \item An {\em instance scope}. | 884 \item An {\em instance scope}. |
884 The enclosing scope of a class' instance scope is the class' static scope. | 885 The enclosing scope of a class' instance scope is the class' static scope. |
885 \end{itemize} | 886 \end{itemize} |
886 | 887 |
888 \LMHash{} | |
887 The enclosing scope of an instance member declaration is the instance scope of t he class in which it is declared. | 889 The enclosing scope of an instance member declaration is the instance scope of t he class in which it is declared. |
888 | 890 |
891 \LMHash{} | |
889 The enclosing scope of a static member declaration is the static scope of the cl ass in which it is declared. | 892 The enclosing scope of a static member declaration is the static scope of the cl ass in which it is declared. |
890 | 893 |
891 | 894 |
892 \LMHash{} | 895 \LMHash{} |
893 Every class has a single superclass except class \code{Object} which has no sup erclass. A class may implement a number of interfaces | 896 Every class has a single superclass except class \code{Object} which has no sup erclass. A class may implement a number of interfaces |
894 %, either | 897 %, either |
895 by declaring them in its implements clause (\ref{superinterfaces}). | 898 by declaring them in its implements clause (\ref{superinterfaces}). |
896 % or via interface injection declarations (\ref{interfaceInjection}) outside the class declaration | 899 % or via interface injection declarations (\ref{interfaceInjection}) outside the class declaration |
897 | 900 |
898 | 901 |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1227 \LMHash{} | 1230 \LMHash{} |
1228 A {\em generative constructor} consists of a constructor name, a constructor par ameter list, and either a redirect clause or an initializer list and an optiona l body. | 1231 A {\em generative constructor} consists of a constructor name, a constructor par ameter list, and either a redirect clause or an initializer list and an optiona l body. |
1229 | 1232 |
1230 \begin{grammar} | 1233 \begin{grammar} |
1231 {\bf constructorSignature:} | 1234 {\bf constructorSignature:} |
1232 identifier (`{\escapegrammar .}' identifier)? formalParameterList | 1235 identifier (`{\escapegrammar .}' identifier)? formalParameterList |
1233 . | 1236 . |
1234 \end{grammar} | 1237 \end{grammar} |
1235 | 1238 |
1236 \LMHash{} | 1239 \LMHash{} |
1237 A {\em constructor parameter list} is a parenthesized, comma-separated list of f ormal constructor parameters. A {\em formal constructor parameter} is either a f ormal parameter (\ref{formalParameters}) or an initializing formal. An {\em init ializing formal} has the form \code{\THIS{}.id}, where \code{id} is the name of an instance variable of the immediately enclosing class. It is a compile-time e rror if \code{id} is not an instance variable of the immediately enclosing class . It is a compile-time error if an initializing formal is used by a function oth er than a non-redirecting generative constructor. | 1240 A {\em constructor parameter list} is a parenthesized, comma-separated list of f ormal constructor parameters. A {\em formal constructor parameter} is either a f ormal parameter (\ref{formalParameters}) or an initializing formal. An {\em init ializing formal} has the form \code{\THIS{}.$id$}, where $id$ is the name of an instance variable of the immediately enclosing class. It is a compile-time erro r if \code{id} is not an instance variable of the immediately enclosing class. I t is a compile-time error if an initializing formal is used by a function other than a non-redirecting generative constructor. |
1238 | 1241 |
1239 \LMHash{} | 1242 \LMHash{} |
1240 If an explicit type is attached to the initializing formal, that is its static t ype. Otherwise, the type of an initializing formal named \code{id} is $T_{id}$, where $T_{id}$ is the type of the field named \code{id} in the immediately enclo sing class. It is a static warning if the static type of \code{id} is not assign able to $T_{id}$. | 1243 If an explicit type is attached to the initializing formal, that is its static t ype. Otherwise, the type of an initializing formal named \code{id} is $T_{id}$, where $T_{id}$ is the type of the field named \code{id} in the immediately enclo sing class. It is a static warning if the static type of \code{id} is not assign able to $T_{id}$. |
1241 | 1244 |
1242 \LMHash{} | 1245 \LMHash{} |
1243 Initializing formals constitute an exception to the rule that every formal param eter introduces a local variable into the formal parameter scope (\ref{formalPar ameters}). | 1246 Initializing formals constitute an exception to the rule that every formal param eter introduces a local variable into the formal parameter scope (\ref{formalPar ameters}). |
1244 When the formal parameter list of a non-redirecting generative constructor conta ins any initializing formals, a new scope is introduced, the {\em formal paramet er initializer scope}, which is the current scope of the initializer list of the constructor, and which is enclosed in the scope where the constructor is declar ed. | 1247 When the formal parameter list of a non-redirecting generative constructor conta ins any initializing formals, a new scope is introduced, the {\em formal paramet er initializer scope}, which is the current scope of the initializer list of the constructor, and which is enclosed in the scope where the constructor is declar ed. |
1245 Each initializing formal in the formal parameter list introduces a final local v ariable into the formal parameter initializer scope, but not into the formal par ameter scope; every other formal parameter introduces a local variable into both the formal parameter scope and the formal parameter initializer scope. | 1248 Each initializing formal in the formal parameter list introduces a final local v ariable into the formal parameter initializer scope, but not into the formal par ameter scope; every other formal parameter introduces a local variable into both the formal parameter scope and the formal parameter initializer scope. |
1246 | 1249 |
1247 \commentary{ | 1250 \commentary{ |
(...skipping 1625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2873 | 2876 |
2874 \LMHash{} | 2877 \LMHash{} |
2875 A {\em symbol literal} denotes the name of a declaration in a Dart program. | 2878 A {\em symbol literal} denotes the name of a declaration in a Dart program. |
2876 | 2879 |
2877 \begin{grammar} | 2880 \begin{grammar} |
2878 {\bf symbolLiteral:} | 2881 {\bf symbolLiteral:} |
2879 `\#' (operator $|$ (identifier (`{\escapegrammar .}' identifier)*)) . | 2882 `\#' (operator $|$ (identifier (`{\escapegrammar .}' identifier)*)) . |
2880 \end{grammar} | 2883 \end{grammar} |
2881 | 2884 |
2882 \LMHash{} | 2885 \LMHash{} |
2883 A symbol literal \code{\#id} where \code{id} does not begin with an underscore ( '\code{\_}') is equivalent to the expression \code{\CONST{} Symbol('id')}. | 2886 A symbol literal \code{\#$id$} where $id$ does not begin with an underscore ('\c ode{\_}') is equivalent to the expression \code{\CONST{} Symbol('$id$')}. |
2884 | 2887 |
2885 \LMHash{} | 2888 \LMHash{} |
2886 A symbol literal \code{\#\_id} evaluates to the object that would be returned by the call \code{MirrorSystem.getSymbol("\_id", libraryMirror)} where \code{libra ryMirror} is an instance of the class \code{LibraryMirror} defined in the librar y \code{dart:mirrors}, reflecting the current library. | 2889 A symbol literal \code{\#\_$id$} evaluates to the object that would be returned by the call \code{MirrorSystem.getSymbol("\_$id$", \metavar{libraryMirror})} whe re \metavar{libraryMirror} is an instance of the class \code{LibraryMirror} defi ned in the library \code{dart:mirrors}, reflecting the current library. |
2887 | 2890 |
2888 \rationale{ | 2891 \rationale{ |
2889 One may well ask what is the motivation for introducing literal symbols? In some languages, symbols are canonicalized whereas strings are not. However literal s trings are already canonicalized in Dart. Symbols are slightly easier to type c ompared to strings and their use can become strangely addictive, but this is not nearly sufficient justification for adding a literal form to the language. The primary motivation is related to the use of reflection and a web specific practi ce known as minification. | 2892 One may well ask what is the motivation for introducing literal symbols? In some languages, symbols are canonicalized whereas strings are not. However literal s trings are already canonicalized in Dart. Symbols are slightly easier to type c ompared to strings and their use can become strangely addictive, but this is not nearly sufficient justification for adding a literal form to the language. The primary motivation is related to the use of reflection and a web specific practi ce known as minification. |
2890 | 2893 |
2891 Minification compresses identifiers consistently throughout a program in order t o reduce download size. This practice poses difficulties for reflective program s that refer to program declarations via strings. A string will refer to an iden tifier in the source, but the identifier will no longer be used in the minified code, and reflective code using these would fail. Therefore, Dart reflection us es objects of type \code{Symbol} rather than strings. Instances of \code{Symbol } are guaranteed to be stable with repeat to minification. Providing a literal f orm for symbols makes reflective code easier to read and write. The fact that sy mbols are easy to type and can often act as convenient substitutes for enums are secondary benefits. | 2894 Minification compresses identifiers consistently throughout a program in order t o reduce download size. This practice poses difficulties for reflective program s that refer to program declarations via strings. A string will refer to an iden tifier in the source, but the identifier will no longer be used in the minified code, and reflective code using these would fail. Therefore, Dart reflection us es objects of type \code{Symbol} rather than strings. Instances of \code{Symbol } are guaranteed to be stable with repeat to minification. Providing a literal f orm for symbols makes reflective code easier to read and write. The fact that sy mbols are easy to type and can often act as convenient substitutes for enums are secondary benefits. |
2892 } | 2895 } |
2893 | 2896 |
2894 \LMHash{} | 2897 \LMHash{} |
2895 The static type of a symbol literal is \code{Symbol}. | 2898 The static type of a symbol literal is \code{Symbol}. |
2896 | 2899 |
(...skipping 917 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3814 \LMHash{} | 3817 \LMHash{} |
3815 Method invocation can take several forms as specified below. | 3818 Method invocation can take several forms as specified below. |
3816 | 3819 |
3817 \subsubsection{Ordinary Invocation} | 3820 \subsubsection{Ordinary Invocation} |
3818 \LMLabel{ordinaryInvocation} | 3821 \LMLabel{ordinaryInvocation} |
3819 | 3822 |
3820 \LMHash{} | 3823 \LMHash{} |
3821 An ordinary method invocation can be {\em conditional} or {\em unconditional}. | 3824 An ordinary method invocation can be {\em conditional} or {\em unconditional}. |
3822 | 3825 |
3823 \LMHash{} | 3826 \LMHash{} |
3824 Evaluation of a {\em conditional ordinary method invocation} $e$ of the form | 3827 Evaluation of a {\em conditional ordinary method invocation} $i$ of the form |
3825 | 3828 |
3826 \LMHash{} | 3829 \LMHash{} |
3827 $o?.m(a_1, \ldots , a_n, x_{n+1}: a_{n+1}, \ldots , x_{n+k}: a_{n+k})$ | 3830 $e?.m(a_1, \ldots , a_n, x_{n+1}: a_{n+1}, \ldots , x_{n+k}: a_{n+k})$ |
3828 | 3831 |
3829 \LMHash{} | 3832 \LMHash{} |
3830 is equivalent to the evaluation of the expression | 3833 proceeds as follows: |
3831 | 3834 |
3832 \LMHash{} | 3835 \LMHash{} |
3833 $((x) => x == \NULL ? \NULL : x.m(a_1, \ldots , a_n, x_{n+1}: a_{n+1}, \ldots , x_{n+k}: a_{n+k}))(o)$. | 3836 If $e$ is a type literal, $i$ is equivalent to \code{$e$.$m$($a_1$, \ldots , $a_ n$, $x_{n+1}$: $a_{n+1}$, \ldots , $x_{n+k}$: $a_{n+k}$)}. |
3834 | |
3835 unless $o$ is a type literal, in which case it is equivalent to $o.m(a_1, \ldot s , a_n, x_{n+1}: a_{n+1}, \ldots , x_{n+k}: a_{n+k})$. | |
3836 | 3837 |
3837 \LMHash{} | 3838 \LMHash{} |
3838 The static type of $e$ is the same as the static type of $o.m(a_1, \ldots , a_n, x_{n+1}: a_{n+1}, \ldots , x_{n+k}: a_{n+k})$. Exactly the same static warnings that would be caused by $o.m(a_1, \ldots , a_n, x_{n+1}: a_{n+1}, \ldots , x_{n +k}: a_{n+k})$ are also generated in the case of $o?.m(a_1, \ldots , a_n, x_{n+1 }: a_{n+1}, \ldots , x_{n+k}: a_{n+k})$. | 3839 Otherwise, evaluate $e$ to an object $o$. |
3840 If $o$ is the null value, $i$ evaluates to the null value. | |
3841 Otherwise let $v$ be a fresh variable bound to $o$ and evaluate | |
3842 \code{$v$.$m$($a_1$, $\ldots$ , $a_n$, $x_{n+1}$: $a_{n+1}$, $\ldots$ , $x_{n+k} $: $a_{n+k}$))} to a value $r$, and then $e$ evaluates to $r$. | |
3843 | |
3844 | |
3845 \LMHash{} | |
3846 The static type of $i$ is the same as the static type of $e.m(a_1, \ldots , a_n, x_{n+1}: a_{n+1}, \ldots , x_{n+k}: a_{n+k})$. Exactly the same static warnings that would be caused by $e.m(a_1, \ldots , a_n, x_{n+1}: a_{n+1}, \ldots , x_{n +k}: a_{n+k})$ are also generated in the case of $e?.m(a_1, \ldots , a_n, x_{n+1 }: a_{n+1}, \ldots , x_{n+k}: a_{n+k})$. | |
3839 | 3847 |
3840 \LMHash{} | 3848 \LMHash{} |
3841 An {\em unconditional ordinary method invocation} $i$ has the form | 3849 An {\em unconditional ordinary method invocation} $i$ has the form |
3842 | 3850 |
3843 $o.m(a_1, \ldots , a_n, x_{n+1}: a_{n+1}, \ldots , x_{n+k}: a_{n+k})$. | 3851 $e.m(a_1, \ldots , a_n, x_{n+1}: a_{n+1}, \ldots , x_{n+k}: a_{n+k})$. |
3844 | 3852 |
3845 \LMHash{} | 3853 \LMHash{} |
3846 Evaluation of an unconditional ordinary method invocation $i$ of the form | 3854 Evaluation of an unconditional ordinary method invocation $i$ of the form |
3847 | 3855 |
3848 $o.m(a_1, \ldots , a_n, x_{n+1}: a_{n+1}, \ldots , x_{n+k}: a_{n+k})$ | 3856 $e.m(a_1, \ldots , a_n, x_{n+1}: a_{n+1}, \ldots , x_{n+k}: a_{n+k})$ |
3849 | 3857 |
3850 proceeds as follows: | 3858 proceeds as follows: |
3851 | 3859 |
3852 \LMHash{} | 3860 \LMHash{} |
3853 First, the expression $o$ is evaluated to a value $v_o$. Next, the argument list $(a_1, \ldots , a_n, x_{n+1}: a_{n+1}, \ldots , x_{n+k}: a_{n+k})$ is evaluated yielding actual argument objects $o_1, \ldots , o_{n+k}$. Let $f$ be the result of looking up (\ref{methodLookup}) method $m$ in $v_o$ with respect to the cur rent library $L$. | 3861 First, the expression $e$ is evaluated to a value $o$. Next, the argument list $ (a_1, \ldots , a_n, x_{n+1}: a_{n+1}, \ldots , x_{n+k}: a_{n+k})$ is evaluated y ielding actual argument objects $o_1, \ldots , o_{n+k}$. Let $f$ be the result o f looking up (\ref{methodLookup}) method $m$ in $o$ with respect to the current library $L$. |
3854 | 3862 |
3855 \LMHash{} | 3863 \LMHash{} |
3856 Let $p_1 \ldots p_h$ be the required parameters of $f$, let $p_1 \ldots p_m$ be the positional parameters of $f$ and let $p_{h+1}, \ldots, p_{h+l}$ be the opti onal parameters declared by $f$. | 3864 Let $p_1 \ldots p_h$ be the required parameters of $f$, let $p_1 \ldots p_m$ be the positional parameters of $f$ and let $p_{h+1}, \ldots, p_{h+l}$ be the opti onal parameters declared by $f$. |
3857 | 3865 |
3858 \commentary{ | 3866 \commentary{ |
3859 We have an argument list consisting of $n$ positional arguments and $k$ named ar guments. We have a function with $h$ required parameters and $l$ optional parame ters. The number of positional arguments must be at least as large as the number of required parameters, and no larger than the number of positional parameters. All named arguments must have a corresponding named parameter. | 3867 We have an argument list consisting of $n$ positional arguments and $k$ named ar guments. We have a function with $h$ required parameters and $l$ optional parame ters. The number of positional arguments must be at least as large as the number of required parameters, and no larger than the number of positional parameters. All named arguments must have a corresponding named parameter. |
3860 } | 3868 } |
3861 | 3869 |
3862 \LMHash{} | 3870 \LMHash{} |
3863 If $n < h$, or $n > m$, the method lookup has failed. Furthermore, each $x_i, n +1 \le i \le n+k$, must have a corresponding named parameter in the set $\{p_{m +1}, \ldots, p_{h+l}\}$ or the method lookup also fails. If $v_o$ is an instanc e of \code{Type} but $o$ is not a constant type literal, then if $m$ is a method that forwards (\ref{functionDeclarations}) to a static method, method lookup fa ils. Otherwise method lookup has succeeded. | 3871 If $n < h$, or $n > m$, the method lookup has failed. Furthermore, each $x_i, n +1 \le i \le n+k$, must have a corresponding named parameter in the set $\{p_{m +1}, \ldots, p_{h+l}\}$ or the method lookup also fails. If $o$ is an instance of \code{Type} but $e$ is not a constant type literal, then if $m$ is a method t hat forwards (\ref{functionDeclarations}) to a static method, method lookup fail s. Otherwise method lookup has succeeded. |
3864 | 3872 |
3865 \LMHash{} | 3873 \LMHash{} |
3866 If the method lookup succeeded, the body of $f$ is executed with respect to the bindings that resulted from the evaluation of the argument list, and with \THIS{ } bound to $v_o$. The value of $i$ is the value returned after $f$ is executed. | 3874 If the method lookup succeeded, the body of $f$ is executed with respect to the bindings that resulted from the evaluation of the argument list, and with \THIS{ } bound to $o$. The value of $i$ is the value returned after $f$ is executed. |
3867 | 3875 |
3868 \LMHash{} | 3876 \LMHash{} |
3869 If the method lookup has failed, then let $g$ be the result of looking up getter (\ref{getterAndSetterLookup}) $m$ in $v_o$ with respect to $L$. | 3877 If the method lookup has failed, then let $g$ be the result of looking up getter (\ref{getterAndSetterLookup}) $m$ in $o$ with respect to $L$. |
3870 If $v_o$ is an instance of \code{Type} but $o$ is not a constant type literal, t hen if $g$ is a getter that forwards to a static getter, getter lookup fails. | 3878 If $o$ is an instance of \code{Type} but $e$ is not a constant type literal, the n if $g$ is a getter that forwards to a static getter, getter lookup fails. |
3871 If the getter lookup succeeded, let $v_g$ be the value of the getter invocation $o.m$. Then the value of $i$ is the result of invoking | 3879 If the getter lookup succeeded, let $v_g$ be the value of the getter invocation $e.m$. Then the value of $i$ is the result of invoking |
3872 the static method \code{Function.apply()} with arguments $v.g, [o_1, \ldots , o_ n], \{\#x_{n+1}: o_{n+1}, \ldots , \#x_{n+k}: o_{n+k}\}$. | 3880 the static method \code{Function.apply()} with arguments $v.g, [o_1, \ldots , o_ n], \{\#x_{n+1}: o_{n+1}, \ldots , \#x_{n+k}: o_{n+k}\}$. |
3873 | 3881 |
3874 \LMHash{} | 3882 \LMHash{} |
3875 If getter lookup has also failed, then a new instance $im$ of the predefined cla ss \code{Invocation} is created, such that: | 3883 If getter lookup has also failed, then a new instance $im$ of the predefined cla ss \code{Invocation} is created, such that: |
3876 \begin{itemize} | 3884 \begin{itemize} |
3877 \item \code{im.isMethod} evaluates to \code{\TRUE{}}. | 3885 \item \code{im.isMethod} evaluates to \code{\TRUE{}}. |
3878 \item \code{im.memberName} evaluates to the symbol \code{m}. | 3886 \item \code{im.memberName} evaluates to the symbol \code{m}. |
3879 \item \code{im.positionalArguments} evaluates to an immutable list with the same values as \code{[$o_1, \ldots, o_n$]}. | 3887 \item \code{im.positionalArguments} evaluates to an immutable list with the same values as \code{[$o_1, \ldots, o_n$]}. |
3880 \item \code{im.namedArguments} evaluates to an immutable map with the same keys and values as \code{\{$\#x_{n+1}: o_{n+1}, \ldots, \#x_{n+k} : o_{n+k}$\}}. | 3888 \item \code{im.namedArguments} evaluates to an immutable map with the same keys and values as \code{\{$\#x_{n+1}: o_{n+1}, \ldots, \#x_{n+k} : o_{n+k}$\}}. |
3881 \end{itemize} | 3889 \end{itemize} |
(...skipping 26 matching lines...) Expand all Loading... | |
3908 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: | 3916 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: |
3909 \begin{itemize} | 3917 \begin{itemize} |
3910 \item | 3918 \item |
3911 $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 | 3919 $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 |
3912 \item $T$ is \code{Type}, $e$ is a constant type literal and the class correspo nding to $e$ has a static getter named $m$. | 3920 \item $T$ is \code{Type}, $e$ is a constant type literal and the class correspo nding to $e$ has a static getter named $m$. |
3913 \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. | 3921 \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. |
3914 } | 3922 } |
3915 \end{itemize} | 3923 \end{itemize} |
3916 | 3924 |
3917 \LMHash{} | 3925 \LMHash{} |
3918 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$. | 3926 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 $fi$ is \DYNAMIC{}; otherwise the static type of $i $ is the declared return type of $F$. |
eernst
2016/11/09 12:38:00
Spurious `f` in `$fi$`?
| |
3919 | 3927 |
3920 \LMHash{} | 3928 \LMHash{} |
3921 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 `.'. | 3929 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 `.'. |
3922 | 3930 |
3923 | 3931 |
3924 \subsubsection{Cascaded Invocations} | 3932 \subsubsection{Cascaded Invocations} |
3925 \LMLabel{cascadedInvocations} | 3933 \LMLabel{cascadedInvocations} |
3926 | 3934 |
3927 \LMHash{} | 3935 \LMHash{} |
3928 A {\em cascaded method invocation} has the form {\em e..suffix} | 3936 A {\em cascaded method invocation} has the form \code{$e$..\metavar{suffix}} |
3929 where $e$ is an expression and {\em suffix} is a sequence of operator, method, g etter or setter invocations. | 3937 where $e$ is an expression and \metavar{suffix} is a sequence of operator, metho d, getter or setter invocations. |
3930 | 3938 |
3931 \begin{grammar} | 3939 \begin{grammar} |
3932 {\bf cascadeSection:} | 3940 {\bf cascadeSection:} |
3933 `{\escapegrammar ..}' (cascadeSelector arguments*) (assignableSelector arg uments*)* (assignmentOperator expressionWithoutCascade)? | 3941 `{\escapegrammar ..}' (cascadeSelector arguments*) (assignableSelector arg uments*)* (assignmentOperator expressionWithoutCascade)? |
3934 . | 3942 . |
3935 | 3943 |
3936 {\bf cascadeSelector:}`[' expression `]'; | 3944 {\bf cascadeSelector:}`[' expression `]'; |
3937 identifier | 3945 identifier |
3938 . | 3946 . |
3939 \end{grammar} | 3947 \end{grammar} |
3940 | 3948 |
3941 \LMHash{} | 3949 \LMHash{} |
3942 A cascaded method invocation expression of the form {\em e..suffix} is equivalen t to the expression \code{(t)\{t.{\em suffix}; \RETURN{} t;\}($e$)}. | 3950 Evaluation of a cascaded method invocation expression $e$ of the form \code{$e$. .\metavar{suffix}} proceeds as follows: |
3951 | |
3952 Evaluate $e$ to an object $o$. | |
3953 Let $t$ be a fresh variable bound to $o$. | |
3954 Evaluate \code{$t$.\metavar{suffix}} to an object. | |
3955 Then $e$ evaluates to $o$. | |
3943 | 3956 |
3944 \rationale{ | 3957 \rationale{ |
3945 With the introduction of null-aware conditional assignable expressions (\ref{ass ignableExpressions}), it would make sense to extend cascades with a null-aware c onditional form as well. One might define {\em e?..suffix} to be equivalent to the expression \code{(t)\{t?.{\em suffix}; \RETURN{} t;\}($e$)}. | 3958 With the introduction of null-aware conditional assignable expressions (\ref{ass ignableExpressions}), it would make sense to extend cascades with a null-aware c onditional form as well. One might define \code{$e$?..\metavar{suffix}} to be eq uivalent to the expression \code{$t$ == null ? null : $t$.\metavar{suffix}} wher e $t$ is a fresh variable bound to the value of $e$. |
3946 | 3959 |
3947 The present specification has not added such a construct, in the interests of si mplicity and rapid language evolution. However, Dart implementations may experim ent with such constructs, as noted in section \ref{ecmaConformance}. | 3960 The present specification has not added such a construct, in the interests of si mplicity and rapid language evolution. However, Dart implementations may experim ent with such constructs, as noted in section \ref{ecmaConformance}. |
3948 } | 3961 } |
3949 | 3962 |
3950 \subsubsection{Super Invocation} | 3963 \subsubsection{Super Invocation} |
3951 \LMLabel{superInvocation} | 3964 \LMLabel{superInvocation} |
3952 | 3965 |
3953 \LMHash{} | 3966 \LMHash{} |
3954 A super method invocation $i$ has the form | 3967 A super method invocation $i$ has the form |
3955 | 3968 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4022 \begin{enumerate} | 4035 \begin{enumerate} |
4023 \item A {\em closurization} which converts a method or constructor into a closur e. Or | 4036 \item A {\em closurization} which converts a method or constructor into a closur e. Or |
4024 \item A {\em getter invocation} which returns the result of invoking of a getter method. | 4037 \item A {\em getter invocation} which returns the result of invoking of a getter method. |
4025 \end{enumerate} | 4038 \end{enumerate} |
4026 | 4039 |
4027 | 4040 |
4028 \commentary{Closures derived from members via closurization are colloquially kno wn as tear-offs} | 4041 \commentary{Closures derived from members via closurization are colloquially kno wn as tear-offs} |
4029 | 4042 |
4030 Property extraction can be either {\em conditional} or {\em unconditional}. | 4043 Property extraction can be either {\em conditional} or {\em unconditional}. |
4031 | 4044 |
4032 Evaluation of a {\em conditional property extraction expression} $e$ of the form $e_1?.id$ is equivalent to the evaluation of the expression $((x) => x == \NU LL ? \NULL : x.id)(e_1)$. | 4045 \LMHash{} |
4033 unless $e_1$ is a type literal, in which case it is equivalent to $e_1.m$. | 4046 Evaluation of a {\em conditional property extraction expression} $e$ |
4047 of the form \code{$e_1$?.\metavar{id}} proceeds as follows: | |
4034 | 4048 |
4035 The static type of $e$ is the same as the static type of $e_1.id$. Let $T$ be th e static type of $e_1$ and let $y$ be a fresh variable of type $T$. Exactly the same static warnings that would be caused by $y.id$ are also generated in the ca se of $e_1?.id$. | 4049 \LMHash{} |
4050 If $e_1$ is a type literal, $e$ is equivalent to \code{$e_1$.$m$}. | |
4051 | |
4052 \LMHash{} | |
4053 Otherwise evaluate $e_1$ to an object $o$. | |
4054 If $o$ is the null value, $e$ evaluates to the null value. | |
4055 Otherwise let $x$ be a fresh variable bound to $o$ | |
4056 and evaluate \code{$x$.\metavar{id}} to a value $r$. | |
4057 Then $e$ evaluates to $r$. | |
4058 | |
4059 | |
4060 The static type of $e$ is the same as the static type of \code{$e_1$.\metavar{id }}. Let $T$ be the static type of $e_1$ and let $y$ be a fresh variable of type $T$. Exactly the same static warnings that would be caused by \code{$y$.\metavar {id}} are also generated in the case of \code{$e_1$?.\metavar{id}}. | |
4036 | 4061 |
4037 \LMHash{} | 4062 \LMHash{} |
4038 Unconditional property extraction has one of two syntactic forms: $e.m$ (\ref{ge tterAccessAndMethodExtraction}) or $\SUPER.m$ (\ref{superGetterAccessAndMethodCl osurization}), where $e$ is an expression and $m$ is an identifier. | 4063 Unconditional property extraction has one of two syntactic forms: $e.m$ (\ref{ge tterAccessAndMethodExtraction}) or $\SUPER.m$ (\ref{superGetterAccessAndMethodCl osurization}), where $e$ is an expression and $m$ is an identifier. |
4039 | 4064 |
4040 \subsubsection{Getter Access and Method Extraction} | 4065 \subsubsection{Getter Access and Method Extraction} |
4041 \LMLabel{getterAccessAndMethodExtraction} | 4066 \LMLabel{getterAccessAndMethodExtraction} |
4042 | 4067 |
4043 \LMHash{} | 4068 \LMHash{} |
4044 Evaluation of a property extraction $i$ of the form $e.m$ proceeds as follows: | 4069 Evaluation of a property extraction $i$ of the form $e.m$ proceeds as follows: |
4045 | 4070 |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4256 \LMHash{} | 4281 \LMHash{} |
4257 Otherwise, the assignment is equivalent to the assignment \code{ \THIS{}.$v$ = $ e$}. | 4282 Otherwise, the assignment is equivalent to the assignment \code{ \THIS{}.$v$ = $ e$}. |
4258 | 4283 |
4259 \LMHash{} | 4284 \LMHash{} |
4260 In checked mode, it is a dynamic type error if $o$ is not \NULL{} and the interf ace of the class of $o$ is not a subtype of the actual type (\ref{actualTypeOfAD eclaration}) of $v$. | 4285 In checked mode, it is a dynamic type error if $o$ is not \NULL{} and the interf ace of the class of $o$ is not a subtype of the actual type (\ref{actualTypeOfAD eclaration}) of $v$. |
4261 | 4286 |
4262 \LMHash{} | 4287 \LMHash{} |
4263 It is a static type warning if the static type of $e$ may not be assigned to the static type of $v$. The static type of the expression $v$ \code{=} $e$ is the s tatic type of $e$. | 4288 It is a static type warning if the static type of $e$ may not be assigned to the static type of $v$. The static type of the expression $v$ \code{=} $e$ is the s tatic type of $e$. |
4264 | 4289 |
4265 \LMHash{} | 4290 \LMHash{} |
4266 Evaluation of an assignment $a$ of the form $e_1?.v$ \code{=} $e_2$ is equivalen t to the evaluation of the expression $((x) => x == \NULL? \NULL: x.v = e_2)(e_1 )$ | 4291 Evaluation of an assignment $a$ of the form \code{$e_1$?.$v$ = $e_2$} |
4267 unless $e_1$ is a type literal, in which case it is equivalent to $e_1.v$ \cod e{=} $e_2$. | 4292 proceeds as follows: |
4268 . The static type of $a$ is the static type of $e_2$. Let $T$ be the static type of $e_1$ and let $y$ be a fresh variable of type $T$. Exactly the same static w arnings that would be caused by $y.v = e_2$ are also generated in the case of $e _1?.v$ \code{=} $e_2$. | 4293 |
4294 \LMHash | |
4295 If $e_1$ is a type literal, $a$ is equivalent to \code{$e_1$.$v$ = $e_2$}. | |
4269 | 4296 |
4270 \LMHash{} | 4297 \LMHash{} |
4271 Evaluation of an assignment of the form $e_1.v$ \code{=} $e_2$ proceeds as follo ws: | 4298 Otherwise evaluate $e_1$ to an object $o$. |
4299 If $o$ is the null value, $a$ evaluates to the null value. | |
4300 Otherwise let $x$ be a fresh variable bound to $o$ | |
4301 and evaluate \code{$x$.$v$ = $e_2$} to an object $r$. | |
4302 Then $a$ evaluates to $r$. | |
4303 | |
4304 \LMHash{} | |
4305 The static type of $a$ is the static type of $e_2$. Let $T$ be the static type o f $e_1$ and let $y$ be a fresh variable of type $T$. Exactly the same static war nings that would be caused by \code{$y$.$v$ = $e_2$} are also generated in the c ase of \code{$e_1$?.$v$ = $e_2$}. | |
4306 | |
4307 \LMHash{} | |
4308 Evaluation of an assignment of the form \code{$e_1$.$v$ = $e_2$} proceeds as fol lows: | |
4272 | 4309 |
4273 \LMHash{} | 4310 \LMHash{} |
4274 The expression $e_1$ is evaluated to an object $o_1$. Then, the expression $e_2$ is evaluated to an object $o_2$. Then, the setter $v=$ is looked up (\ref{gett erAndSetterLookup}) in $o_1$ with respect to the current library. If $o_1$ is a n instance of \code{Type} but $e_1$ is not a constant type literal, then if $v=$ is a setter that forwards (\ref{functionDeclarations}) to a static setter, sett er lookup fails. Otherwise, the body of $v=$ is executed with its formal parame ter bound to $o_2$ and \THIS{} bound to $o_1$. | 4311 The expression $e_1$ is evaluated to an object $o_1$. Then, the expression $e_2$ is evaluated to an object $o_2$. Then, the setter $v=$ is looked up (\ref{gett erAndSetterLookup}) in $o_1$ with respect to the current library. If $o_1$ is a n instance of \code{Type} but $e_1$ is not a constant type literal, then if $v=$ is a setter that forwards (\ref{functionDeclarations}) to a static setter, sett er lookup fails. Otherwise, the body of $v=$ is executed with its formal parame ter bound to $o_2$ and \THIS{} bound to $o_1$. |
4275 | 4312 |
4276 \LMHash{} | 4313 \LMHash{} |
4277 If the setter lookup has failed, then a new instance $im$ of the predefined cla ss \code{Invocation} is created, such that : | 4314 If the setter lookup has failed, then a new instance $im$ of the predefined cla ss \code{Invocation} is created, such that : |
4278 \begin{itemize} | 4315 \begin{itemize} |
4279 \item \code{im.isSetter} evaluates to \code{\TRUE{}}. | 4316 \item \code{im.isSetter} evaluates to \code{\TRUE{}}. |
4280 \item \code{im.memberName} evaluates to the symbol \code{v=}. | 4317 \item \code{im.memberName} evaluates to the symbol \code{v=}. |
4281 \item \code{im.positionalArguments} evaluates to an immutable list with the same values as \code{[$o_2$]}. | 4318 \item \code{im.positionalArguments} evaluates to an immutable list with the same values as \code{[$o_2$]}. |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4341 | 4378 |
4342 \LMHash{} | 4379 \LMHash{} |
4343 In checked mode, it is a dynamic type error if $o$ is not \NULL{} and the interf ace of the class of $o$ is not a subtype of the actual type of $S.v$. | 4380 In checked mode, it is a dynamic type error if $o$ is not \NULL{} and the interf ace of the class of $o$ is not a subtype of the actual type of $S.v$. |
4344 | 4381 |
4345 \LMHash{} | 4382 \LMHash{} |
4346 Let $S_{static}$ be the superclass of the immediately enclosing class. It is a s tatic type warning if $S_{static}$ does not have an accessible instance setter n amed $v=$ unless $S_{static}$ or a superinterface of $S_{static}$ is annotated w ith an annotation denoting a constant identical to the constant \code{@proxy} de fined in \code{dart:core}. | 4383 Let $S_{static}$ be the superclass of the immediately enclosing class. It is a s tatic type warning if $S_{static}$ does not have an accessible instance setter n amed $v=$ unless $S_{static}$ or a superinterface of $S_{static}$ is annotated w ith an annotation denoting a constant identical to the constant \code{@proxy} de fined in \code{dart:core}. |
4347 | 4384 |
4348 \LMHash{} | 4385 \LMHash{} |
4349 It is a static type warning if the static type of $e$ may not be assigned to the static type of the formal parameter of the setter $v=$. The static type of th e expression $\SUPER.v$ \code{=} $e$ is the static type of $e$. | 4386 It is a static type warning if the static type of $e$ may not be assigned to the static type of the formal parameter of the setter $v=$. The static type of th e expression $\SUPER.v$ \code{=} $e$ is the static type of $e$. |
4350 | 4387 |
4351 | 4388 \LMHash{} |
4352 | 4389 Evaluation of an assignment $e$ of the form \code{$e_1$[$e_2$] = $e_3$} |
4353 | 4390 proceeds as follows: |
4354 | |
4355 | 4391 |
4356 \LMHash{} | 4392 \LMHash{} |
4357 Evaluation of an assignment of the form $e_1[e_2]$ \code{=} $e_3$ is equivalent to the evaluation of the expression \code{(a, i, e)\{a.[]=(i, e); \RETURN{} e; \ } ($e_1, e_2, e_3$)}. The static type of the expression $e_1[e_2]$ \code{=} $e_ 3$ is the static type of $e_3$. | 4393 Evaluate $e_1$ to an object $a$, then evaluate $e_2$ to an object $i$, and final ly evaluate $e_3$ to an object $v$. |
4394 Call the method \code{[]=} on $a$ with $i$ as first argument and $v$ as second a rgument. | |
4395 Then $e$ evaluates to $v$. | |
4358 | 4396 |
4359 \LMHash{} | 4397 \LMHash{} |
4360 An assignment of the form $\SUPER[e_1]$ \code{=} $e_2$ is equivalent to the expr ession $\SUPER.[e_1]$ \code{=} $e_2$. The static type of the expression $\SUPER [e_1]$ \code{=} $e_2$ is the static type of $e_2$. | 4398 The static type of the expression \code{$e_1$[$e_2$] = $e_3$} is the static type of $e_3$. |
4399 | |
4400 \LMHash{} | |
4401 An assignment of the form \code{\SUPER[$e_1$] = $e_2$} is equivalent to the expr ession \code{\SUPER.[$e_1$] = $e_2$}. The static type of the expression \code{\ SUPER[$e_1$] = $e_2$} is the static type of $e_2$. | |
4361 | 4402 |
4362 | 4403 |
4363 % Should we add: It is a dynamic error if $e_1$ evaluates to an constant list o r map. | 4404 % Should we add: It is a dynamic error if $e_1$ evaluates to an constant list o r map. |
4364 | 4405 |
4365 \LMHash{} | 4406 \LMHash{} |
4366 It is a static warning if an assignment of the form $v = e$ occurs inside a top level or static function (be it function, method, getter, or setter) or variable initializer and there is neither a local variable declaration with name $v$ no r setter declaration with name $v=$ in the lexical scope enclosing the assignmen t. | 4407 It is a static warning if an assignment of the form $v = e$ occurs inside a top level or static function (be it function, method, getter, or setter) or variable initializer and there is neither a local variable declaration with name $v$ no r setter declaration with name $v=$ in the lexical scope enclosing the assignmen t. |
4367 | 4408 |
4368 \LMHash{} | 4409 \LMHash{} |
4369 It is a compile-time error to invoke any of the setters of class \cd{Object} on a prefix object (\ref{imports}) or on a constant type literal that is immediate ly followed by the token `.'. | 4410 It is a compile-time error to invoke any of the setters of class \cd{Object} on a prefix object (\ref{imports}) or on a constant type literal that is immediate ly followed by the token `.'. |
4370 | 4411 |
4371 | 4412 |
4372 | 4413 |
4373 \subsubsection{Compound Assignment} | 4414 \subsubsection{Compound Assignment} |
4374 \LMLabel{compoundAssignment} | 4415 \LMLabel{compoundAssignment} |
4375 | 4416 |
4376 \LMHash{} | 4417 \LMHash{} |
4377 Evaluation of a compound assignment of the form $v$ {\em ??=} $e$ is equivalent to the evaluation of the expression $((x) => x == \NULL{}$ ? $v=e : x)(v)$ whe re $x$ is a fresh variable that is not used in $e$. | 4418 Evaluation of a compound assignment $a$ of the form \code{$v$ ??= $e$} |
4419 proceeds as follows: | |
4420 | |
4421 Evaluate $v$ to an object $o$. | |
4422 If $o$ is not the null value, $a$ evaluates to $o$. | |
4423 Otherwise evaluate \code{$v$ = $e$} to a value $r$, | |
4424 and then $a$ evaluates to $r$. | |
4378 | 4425 |
4379 \LMHash{} | 4426 \LMHash{} |
4380 Evaluation of a compound assignment of the form $C.v$ {\em ??=} $e$, where $C$ i s a type literal, is equivalent to the evaluation of the expression $((x) => x == \NULL{}$? $C.v=e: x)(C.v)$ where $x$ is a fresh variable that is not used in $e$. | 4427 Evaluation of a compound assignment, $a$ of the form \code{$C$.$v$ ??= $e$}, whe re $C$ is a type literal, proceeds as follow: |
4428 | |
4429 Evaluate \code{$C$.$v$} to an object $o$. | |
4430 If $o$ is not the null value, $a$ evaluates to $o$. | |
4431 Otherwise evaluate \code{$C$.$v$ = $e$} to a value $r$, | |
4432 and then $a$ evaluates to $r$. | |
4381 | 4433 |
4382 \commentary { | 4434 \commentary { |
4383 The two rules above also apply when the variable v or the type C is prefixed. | 4435 The two rules above also apply when the variable v or the type C is prefixed. |
4384 } | 4436 } |
4385 | 4437 |
4386 \LMHash{} | 4438 \LMHash{} |
4387 Evaluation of a compound assignment of the form $e_1.v$ {\em ??=} $e_2$ is equiv alent to the evaluation of the expression $((x) =>((y) => y == \NULL{}$ ? $ x.v = e_2: y)(x.v))(e_1)$ where $x$ and $y$ are distinct fresh variables that are n ot used in $e_2$. | 4439 Evaluation of a compound assignment $a$ of the form \code{$e_1$.$v$ ??= $e_2$} |
4440 proceeds as follows: | |
4388 | 4441 |
4389 \LMHash{} | 4442 \LMHash{} |
4390 Evaluation of a compound assignment of the form $e_1[e_2]$ {\em ??=} $e_3$ is equivalent to the evaluation of the expression | 4443 Evaluate $e_1$ to an object $u$. |
4391 $((a, i) => ((x) => x == \NULL{}$ ? $a[i] = e_3: x)(a[i]))(e_1, e_2)$ where $x$ , $a$ and $i$ are distinct fresh variables that are not used in $e_3$. | 4444 Let $x$ be a fresh variable bound to $u$. |
4445 Evalute \code{$x$.$v$} to an object $o$. | |
4446 If $o$ is not the null value, $a$ evaluates to $o$. | |
4447 Otherwise evaluate \code{$x$.$v$ = $e_2$} to an object $r$, | |
4448 and then $a$ evaluates to $r$. | |
4392 | 4449 |
4393 \LMHash{} | 4450 \LMHash{} |
4394 Evaluation of a compound assignment of the form $\SUPER.v$ {\em ??=} $e$ is equ ivalent to the evaluation of the expression $((x) => x == \NULL{}$ ? $\SUPER.v = e: x)(\SUPER.v)$ where $x$ is a fresh variable that is not used in $e$. | 4451 Evaluation of a compound assignment $a$ of the form \code{$e_1$[$e_2$] ??= $e_3$ } |
4452 proceeds as follows: | |
4395 | 4453 |
4396 \LMHash{} | 4454 \LMHash{} |
4397 Evaluation of a compound assignment of the form $e_1?.v$ {\em ??=} $e_2$ is equ ivalent to the evaluation of the expression \code{((x) $=>$ x == \NULL{} ? \NUL L: $x.v ??= e_2$)($e_1$)} where $x$ is a variable that is not used in $e_2$. | 4455 Evaluate $e_1$ to an object $u$ and then evaluate $e_2$ to an object $i$. |
4456 Call the \code{[]} method on $u$ with argument $i$, and let $o$ be the returned value. | |
4457 If $o$ is not the null value, $a$ evaluates to $o$. | |
4458 Otherwise evaluate $e_3$ to an object $v$ | |
4459 and then call the \code{[]=} method on $u$ with $i$ as first argument and $v$ as second argument. | |
4460 Then $a$ evaluates to $v$. | |
4461 | |
4462 \LMHash{} | |
4463 Evaluation of a compound assignment $a$ of the form \code{\SUPER.$v$ ??= $e$} | |
4464 proceeds as follows: | |
4465 | |
4466 \LMHash{} | |
4467 Evaluate \code{\SUPER.$v$} to an object $o$. | |
4468 If $o$ is not the null value then $a$ evaluats to $o$. | |
4469 Otherwise evaluate \code{\SUPER.$v$ = $e$} to an object $r$, | |
4470 and then $a$ evaluates to $r$. | |
4471 | |
4472 \LMHash{} | |
4473 Evaluation of a compound assignment $a$ of the form \code{$e_1$?.$v$ ??= $e_2$} | |
4474 proceeds as follows: | |
4475 | |
4476 \LMHash{} | |
4477 Evaluate $e_1$ to an object $u$ and let $x$ be a fresh variable bound to $u$. | |
4478 Evaluate \code{$x$.$v$} to an object $o$. | |
4479 If $o$ is not the null value then $a$ evaluates to $o$. | |
4480 Otherwise evaluate \code{$x$.$v$ = $e_2$} to an object $r$, | |
4481 and then $a$ evaluates to $r$. | |
4482 | |
4398 % But what about C?.v ??= e | 4483 % But what about C?.v ??= e |
4399 | 4484 |
4400 \LMHash{} | 4485 \LMHash{} |
4401 A compound assignment of the form $C?.v$ {\em ??=} $e_2$ is equivalent to the e xpression $C.v$ {\em ??=} $e$. | 4486 A compound assignment of the form $C?.v$ {\em ??=} $e_2$ is equivalent to the e xpression $C.v$ {\em ??=} $e$. |
4402 | 4487 |
4403 \LMHash{} | 4488 \LMHash{} |
4404 The static type of a compound assignment of the form $v$ {\em ??=} $e$ is the le ast upper bound of the static type of $v$ and the static type of $e$. Exactly t he same static warnings that would be caused by $v = e$ are also generated in th e case of $v$ {\em ??=} $e$. | 4489 The static type of a compound assignment of the form $v$ {\em ??=} $e$ is the le ast upper bound of the static type of $v$ and the static type of $e$. Exactly t he same static warnings that would be caused by $v = e$ are also generated in th e case of $v$ {\em ??=} $e$. |
4405 | 4490 |
4406 | |
4407 \LMHash{} | 4491 \LMHash{} |
4408 The static type of a compound assignment of the form $C.v$ {\em ??=} $e$ is th e least upper bound of the static type of $C.v$ and the static type of $e$. Exa ctly the same static warnings that would be caused by $C.v = e$ are also generat ed in the case of $C.v$ {\em ??=} $e$. | 4492 The static type of a compound assignment of the form $C.v$ {\em ??=} $e$ is th e least upper bound of the static type of $C.v$ and the static type of $e$. Exa ctly the same static warnings that would be caused by $C.v = e$ are also generat ed in the case of $C.v$ {\em ??=} $e$. |
4409 | 4493 |
4410 \LMHash{} | 4494 \LMHash{} |
4411 The static type of a compound assignment of the form $e_1.v$ {\em ??=} $e_2$ is the least upper bound of the static type of $e_1.v$ and the static type of $e_2 $. Let $T$ be the static type of $e_1$ and let $z$ be a fresh variable of type $ T$. Exactly the same static warnings that would be caused by $z.v = e_2$ are als o generated in the case of $e_1.v$ {\em ??=} $e_2$. | 4495 The static type of a compound assignment of the form $e_1.v$ {\em ??=} $e_2$ is the least upper bound of the static type of $e_1.v$ and the static type of $e_2 $. Let $T$ be the static type of $e_1$ and let $z$ be a fresh variable of type $ T$. Exactly the same static warnings that would be caused by $z.v = e_2$ are als o generated in the case of $e_1.v$ {\em ??=} $e_2$. |
4412 | 4496 |
4413 \LMHash{} | 4497 \LMHash{} |
4414 The static type of a compound assignment of the form $e_1[e_2]$ {\em ??=} $e_3$ is the least upper bound of the static type of $e_1[e_2]$ and the static type of $e_3$. Exactly the same static warnings that would be caused by $e_1[e_2] = e _3$ are also generated in the case of $e_1[e_2]$ {\em ??=} $e_3$. | 4498 The static type of a compound assignment of the form $e_1[e_2]$ {\em ??=} $e_3$ is the least upper bound of the static type of $e_1[e_2]$ and the static type of $e_3$. Exactly the same static warnings that would be caused by $e_1[e_2] = e _3$ are also generated in the case of $e_1[e_2]$ {\em ??=} $e_3$. |
4415 | 4499 |
4416 \LMHash{} | 4500 \LMHash{} |
4417 The static type of a compound assignment of the form $\SUPER.v$ {\em ??=} $e$ is the least upper bound of the static type of $\SUPER.v$ and the static type of $e$. Exactly the same static warnings that would be caused by $\SUPER.v = e$ ar e also generated in the case of $\SUPER.v$ {\em ??=} $e$. | 4501 The static type of a compound assignment of the form $\SUPER.v$ {\em ??=} $e$ is the least upper bound of the static type of $\SUPER.v$ and the static type of $e$. Exactly the same static warnings that would be caused by $\SUPER.v = e$ ar e also generated in the case of $\SUPER.v$ {\em ??=} $e$. |
4418 | 4502 |
4419 \LMHash{} | 4503 \LMHash{} |
4420 For any other valid operator $op$, a compound assignment of the form $v$ $op\cod e{=} e$ is equivalent to $v \code{=} v$ $op$ $e$. A compound assignment of the f orm $C.v$ $op \code{=} e$ is equivalent to $C.v \code{=} C.v$ $op$ $e$. A compou nd assignment of the form $e_1.v$ $op = e_2$ is equivalent to \code{((x) $=>$ x. v = x.v $op$ $e_2$)($e_1$)} where $x$ is a variable that is not used in $e_2$. A compound assignment of the form $e_1[e_2]$ $op\code{=} e_3$ is equivalent to | 4504 For any other valid operator $op$, a compound assignment of the form \code{$v$ $ op$= $e$} is equivalent to \code{$v$ = $v$ $op$ $e$}. A compound assignment of t he form \code{$C$.$v$ $op$= $e$} is equivalent to \code{$C$.$v$ = $C$.$v$ $op$ $ e$}. |
4421 \code{((a, i) $=>$ a[i] = a[i] $op$ $e_3$)($e_1, e_2$)} where $a$ and $i$ are a variables that are not used in $e_3$. | |
4422 | 4505 |
4423 \LMHash{} | 4506 \LMHash{} |
4424 Evaluation of a compound assignment of the form $e_1?.v$ $op = e_2$ is equivalen t to \code{((x) $=>$ x?.v = x.v $op$ $e_2$)($e_1$)} where $x$ is a variable that is not used in $e_2$. The static type of $e_1?.v$ $op = e_2$ is the static type of $e_1.v$ $op$ $e_2$. Exactly the same static warnings that would be caused by $e_1.v$ $op = e_2$ are also generated in the case of $e_1?.v$ $op = e_2$. | 4507 Evaluation of a compound assignment $a$ of the form \code{$e_1$.$v$ $op$= $e_2$} proceeds as follows: |
4508 Evaluate $e_1$ to an object $u$ and let $x$ be a fresh variable bound to $u$. | |
4509 Evaluate \code{$x$.$v$ = $x$.$v$ $op$ $e_2$} to an object $r$ | |
4510 and then $a$ evaluates to $r$. | |
4511 | |
4512 \LMHash{} | |
4513 Evaluation of s compound assignment $a$ of the form \code{$e_1$[$e_2$] $op$= $e_ 3$} proceeds as follows: | |
4514 Evaluate $e_1$ to an object $u$ and evaluate $e_2$ to an object $v$. | |
4515 Let $a$ and $i$ be fresh variables bound to $u$ and $v$ respectively. | |
4516 Evaluate \code{$a$[$i$] = $a$[$i$] $op$ $e_3$} to an object $r$, | |
4517 and then $a$ evaluates to $r$. | |
4518 | |
4519 \LMHash{} | |
4520 Evaluation of a compound assignment $a$ of the form \code{$e_1$?.$v$ $op$ = $e_2 $} proceeds as follows: | |
4521 | |
4522 \LMHash{} | |
4523 Evaluate $e_1$ to an object $u$. | |
4524 If $u$ is the null value, then $a$ evaluates to the null value. | |
4525 Otherwise let $x$ be a fresh variable bound to $u$. | |
4526 Evaluate \code{$x$.$v$ $op$= $e_2$} to an object $r$. | |
4527 Then $a$ evaluates to $r$. | |
4528 | |
4529 \LMHash{} | |
4530 The static type of \code{$e_1$?.$v$ $op$= $e_2$} is the static type of \code{$e_ 1$.$v$ $op$ $e_2$}. Exactly the same static warnings that would be caused by \co de{$e_1$.$v$ $op$= $e_2$} are also generated in the case of \code{$e_1$?.$v$ $op $= $e_2$}. | |
4425 | 4531 |
4426 \LMHash{} | 4532 \LMHash{} |
4427 A compound assignment of the form $C?.v$ $op = e_2$ is equivalent to the express ion | 4533 A compound assignment of the form $C?.v$ $op = e_2$ is equivalent to the express ion |
4428 $C.v$ $op = e_2$. | 4534 $C.v$ $op = e_2$. |
4429 | 4535 |
4430 \begin{grammar} | 4536 \begin{grammar} |
4431 {\bf compoundAssignmentOperator:}`*='; | 4537 {\bf compoundAssignmentOperator:}`*='; |
4432 `/='; | 4538 `/='; |
4433 `\~{}/='; | 4539 `\~{}/='; |
4434 `\%='; | 4540 `\%='; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4482 | 4588 |
4483 \LMHash{} | 4589 \LMHash{} |
4484 An {\em if-null expression}evaluates an expression and if the result is \NULL, evaluates another. | 4590 An {\em if-null expression}evaluates an expression and if the result is \NULL, evaluates another. |
4485 | 4591 |
4486 \begin{grammar} | 4592 \begin{grammar} |
4487 {\bf ifNullExpression:} | 4593 {\bf ifNullExpression:} |
4488 logicalOrExpression (`??' logicalOrExpression)* | 4594 logicalOrExpression (`??' logicalOrExpression)* |
4489 \end{grammar} | 4595 \end{grammar} |
4490 | 4596 |
4491 \LMHash{} | 4597 \LMHash{} |
4492 Evaluation of an if-null expression $e$ of the form $e_1??e_2 $ is equivalent to the evaluation of the expression $((x) => x == \NULL? e_2: x)(e_1)$. The static type of $e$ is least upper bound (\ref{leastUpperBounds}) of the static type of $e_1$ and the static type of $e_2$. | 4598 Evaluation of an if-null expression $e$ of the form \code{$e_1$ ?? $e_2$} |
4599 proceeds as follows: | |
4600 | |
4601 \LMHash{} | |
4602 Evaluate $e_1$ to an object $o$. | |
4603 If $o$ is not the null value, then $e$ evaluates to $o$. | |
4604 Otherwise evaluate $e_2$ to an object $r$, | |
4605 and then $e$ evaluates to $r$. | |
4606 | |
4607 \LMHash{} | |
4608 The static type of $e$ is the least upper bound (\ref{leastUpperBounds}) of the static type of $e_1$ and the static type of $e_2$. | |
4493 | 4609 |
4494 | 4610 |
4495 \subsection{ Logical Boolean Expressions} | 4611 \subsection{ Logical Boolean Expressions} |
4496 \LMLabel{logicalBooleanExpressions} | 4612 \LMLabel{logicalBooleanExpressions} |
4497 | 4613 |
4498 \LMHash{} | 4614 \LMHash{} |
4499 The logical boolean expressions combine boolean objects using the boolean conjun ction and disjunction operators. | 4615 The logical boolean expressions combine boolean objects using the boolean conjun ction and disjunction operators. |
4500 | 4616 |
4501 \begin{grammar} | 4617 \begin{grammar} |
4502 {\bf logicalOrExpression:} | 4618 {\bf logicalOrExpression:} |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4853 {\bf incrementOperator:}`++'; | 4969 {\bf incrementOperator:}`++'; |
4854 `-{}-' | 4970 `-{}-' |
4855 . | 4971 . |
4856 | 4972 |
4857 \end{grammar} | 4973 \end{grammar} |
4858 | 4974 |
4859 \LMHash{} | 4975 \LMHash{} |
4860 A {\em postfix expression} is either a primary expression, a function, method o r getter invocation, or an invocation of a postfix operator on an expression $e$ . | 4976 A {\em postfix expression} is either a primary expression, a function, method o r getter invocation, or an invocation of a postfix operator on an expression $e$ . |
4861 | 4977 |
4862 \LMHash{} | 4978 \LMHash{} |
4863 Execution of a postfix expression of the form \code{$v$++}, where $v$ is an iden tifier, is equivalent to executing \code{()\{\VAR{} r = $v$; $v$ = r + 1; \RETUR N{} r\}()}. | 4979 Evaluation of a postfix expression $e$ of the form \code{$v$++}, where $v$ is an identifier, proceeds as follows: |
4980 | |
4981 \LMHash{} | |
4982 Evaluate $v$ to an object $r$ and let $y$ be a fresh variable bound to $r$. | |
4983 Evaluate \code{$v$ = $y$ + 1}. | |
4984 Then $e$ evaluates to $r$. | |
4864 | 4985 |
4865 \LMHash{} | 4986 \LMHash{} |
4866 The static type of such an expression is the static type of $v$. | 4987 The static type of such an expression is the static type of $v$. |
4867 | 4988 |
4868 | 4989 |
4869 \rationale{The above ensures that if $v$ is a field, the getter gets called exac tly once. Likewise in the cases below. | 4990 \rationale{The above ensures that if $v$ is a field, the getter gets called exac tly once. Likewise in the cases below. |
4870 } | 4991 } |
4871 | 4992 |
4872 \LMHash{} | 4993 \LMHash{} |
4873 Execution of a postfix expression of the form \code{$C.v$ ++} is equivalent to e xecuting | 4994 Evaluation of a postfix expression $e$ of the form \code{$C$.$v$++} |
4874 | 4995 proceeds as follows: |
4875 \code{()\{\VAR{} r = $C.v$; $C.v$ = r + 1; \RETURN{} r\}()}. | |
4876 | 4996 |
4877 \LMHash{} | 4997 \LMHash{} |
4878 The static type of such an expression is the static type of $C.v$. | 4998 Evaluate \code{$C$.$v$} to a value $r$ |
4999 and let $y$ be a fresh variable bound to $r$. | |
5000 Evaluate \code{$C$.$v$ = $y$ + 1}. | |
5001 Then $e$ evaluates to $r$. | |
5002 | |
5003 \LMHash{} | |
5004 The static type of such an expression is the static type of \code{$C$.$v$}. | |
4879 | 5005 |
4880 | 5006 |
4881 \LMHash{} | 5007 \LMHash{} |
4882 Execution of a postfix expression of the form \code{$e_1.v$++} is equivalent to executing | 5008 Evaluation of a postfix expression $e$ of the form \code{$e_1$.$v$++} |
4883 | 5009 proceeds as follows: |
4884 \code{(x)\{\VAR{} r = x.v; x.v = r + 1; \RETURN{} r\}($e_1$)}. | |
4885 | 5010 |
4886 \LMHash{} | 5011 \LMHash{} |
4887 The static type of such an expression is the static type of $e_1.v$. | 5012 Evaluate $e_1$ to an object $u$ and let $x$ be a fresh variable bound to $u$. |
5013 Evaluate \code{$x$.$v$} to a value $r$ | |
5014 and let $y$ be a fresh variable bound to $r$. | |
5015 Evaluate \code{$x$.$v$ = $y$ + 1}. | |
5016 Then $e$ evaluates to $r$. | |
5017 | |
5018 \LMHash{} | |
5019 The static type of such an expression is the static type of \code{$e_1$.$v$}. | |
4888 | 5020 |
4889 | 5021 |
4890 \LMHash{} | 5022 \LMHash{} |
4891 Execution of a postfix expression of the form \code{$e_1[e_2]$++}, is equivalen t to executing | 5023 Evaluation of a postfix expression $e$ of the form \code{$e_1$[$e_2$]++} |
4892 | 5024 proceeds as follows: |
4893 \code{(a, i)\{\VAR{} r = a[i]; a[i] = r + 1; \RETURN{} r\}($e_1$, $e_2$)}. | |
4894 | 5025 |
4895 \LMHash{} | 5026 \LMHash{} |
4896 The static type of such an expression is the static type of $e_1[e_2]$. | 5027 Evaluate $e_1$ to an object $u$ and $e_2$ to an object $v$. |
5028 Let $a$ and $i$ be fresh variables bound to $u$ and $v$ respectively. | |
5029 Evaluate \code{$a$[$i$]} to an object $r$ | |
5030 and let $y$ be a fresh variable bound to $r$. | |
5031 Evaluate \code{$a$[$i$] = $y$ + 1}. | |
5032 Then $e$ evaluates to $r$. | |
5033 | |
5034 \LMHash{} | |
5035 The static type of such an expression is the static type of \code{$e_1$[$e_2$]}. | |
4897 | 5036 |
4898 | 5037 |
4899 \LMHash{} | 5038 \LMHash{} |
4900 Execution of a postfix expression of the form \code{$v$-{}-}, where $v$ is an id entifier, is equivalent to executing | 5039 Evaluation of a postfix expression $e$ of the form \code{$v$-{}-}, where $v$ is an identifier, proceeds as follows: |
4901 | 5040 |
4902 \code{()\{\VAR{} r = $v$; $v$ = r - 1; \RETURN{} r\}()}. | 5041 \LMHash{} |
5042 Evaluate the expression $v$ to an object $r$ | |
5043 and let $y$ be a fresh variable bound to $r$. | |
5044 Evaluate \code{$v$ = $y$ - 1}. | |
5045 Then $e$ evaluates to $r$. | |
4903 | 5046 |
4904 \LMHash{} | 5047 \LMHash{} |
4905 The static type of such an expression is the static type of $v$. | 5048 The static type of such an expression is the static type of $v$. |
4906 | 5049 |
4907 | 5050 |
4908 \LMHash{} | 5051 \LMHash{} |
4909 Execution of a postfix expression of the form \code{$C.v$-{}-} is equivalent to executing | 5052 Evaluation of a postfix expression $e$ of the form \code{$C$.$v$-{}-} |
4910 | 5053 proceeds as follows: |
4911 \code{()\{\VAR{} r = $C.v$; $C.v$ = r - 1; \RETURN{} r\}()}. | |
4912 | 5054 |
4913 \LMHash{} | 5055 \LMHash{} |
4914 The static type of such an expression is the static type of $C.v$. | 5056 Evaluate \code{$C$.$v$} to a value $r$ |
5057 and let $y$ be a fresh variable bound to $r$. | |
5058 Evaluate \code{$C$.$v$ = $y$ - 1}. | |
5059 Then $e$ evaluates to $r$. | |
5060 | |
5061 \LMHash{} | |
5062 The static type of such an expression is the static type of \code{$C$.$v$}. | |
4915 | 5063 |
4916 | 5064 |
4917 \LMHash{} | 5065 \LMHash{} |
4918 Execution of a postfix expression of the form \code{$e_1.v$-{}-} is equivalent t o executing | 5066 Evaluation of a postfix expression of the form \code{$e_1$.$v$-{}-} |
4919 | 5067 proceeds as follows: |
4920 \code{(x)\{\VAR{} r = x.v; x.v = r - 1; \RETURN{} r\}($e_1$)}. | |
4921 | 5068 |
4922 \LMHash{} | 5069 \LMHash{} |
4923 The static type of such an expression is the static type of $e_1.v$. | 5070 Evaluate $e_1$ to an object $u$ and let $x$ be a fresh variable bound to $u$. |
5071 Evaluate \code{$x$.$v$} to a value $r$ | |
5072 and let $y$ be a fresh variable bound to $r$. | |
5073 Evaluate \code{$x$.$v$ = $y$ - 1}. | |
5074 Then $e$ evaluates to $r$. | |
4924 | 5075 |
4925 | 5076 |
4926 \LMHash{} | 5077 \LMHash{} |
4927 Execution of a postfix expression of the form \code{$e_1[e_2]$-{}-}, is equival ent to executing | 5078 The static type of such an expression is the static type of \code{$e_1$.$v$}. |
4928 | 5079 |
4929 \code{(a, i)\{\VAR{} r = a[i]; a[i] = r - 1; \RETURN{} r\}($e_1$, $e_2$)}. | |
4930 | 5080 |
4931 \LMHash{} | 5081 \LMHash{} |
4932 The static type of such an expression is the static type of $e_1[e_2]$. | 5082 Evaluation of a postfix expression $e$ of the form \code{$e_1$[$e_2$]-{}-} |
5083 proceeds as follows: | |
4933 | 5084 |
4934 \LMHash{} | 5085 \LMHash{} |
4935 Execution of a postfix expression of the form \code{$e_1?.v$++} is equivalent to executing | 5086 Evaluate $e_1$ to an object $u$ and $e_2$ to an object $v$. |
4936 | 5087 Let $a$ and $i$ be fresh variables bound to $u$ and $v$ respectively. |
4937 \code{((x) =$>$ x == \NULL? \NULL : x.v++)($e_1$)} | 5088 Evaluate \code{$a$[$i$]} to an object $r$ |
4938 unless $e_1$ is a type literal, in which case it is equivalent to \code{$e_1.v$+ +} | 5089 and let $y$ be a fresh variable bound to $r$. |
4939 . | 5090 Evaluate \code{$a$[$i$] = $y$ - 1}. |
5091 Then $e$ evaluates to $r$. | |
4940 | 5092 |
4941 \LMHash{} | 5093 \LMHash{} |
4942 The static type of such an expression is the static type of $e_1.v$. | 5094 The static type of such an expression is the static type of \code{$e_1$[$e_2$]}. |
4943 | 5095 |
4944 \LMHash{} | 5096 \LMHash{} |
4945 Execution of a postfix expression of the form \code{$e_1?.v$-{}-} is equivalent to executing | 5097 Evaluation of a postfix expression $e$ of the form \code{$e_1$?.$v$++} |
4946 | 5098 where $e_1$ is not a type literal, proceeds as follows: |
4947 \code{((x) =$>$ x == \NULL? \NULL : x.v-{}-)($e_1$)} | |
4948 unless $e_1$ is a type literal, in which case it is equivalent to \code{$e_1.v$- {}-} | |
4949 . | |
4950 | 5099 |
4951 \LMHash{} | 5100 \LMHash{} |
4952 The static type of such an expression is the static type of $e_1.v$. | 5101 If $e_1$ is a type literal, $e$ is equivalent to \code{$e_1$.$v$++}. |
5102 | |
5103 \LMHash{} | |
5104 Otherwise evaluate $e_1$ to an object $u$. | |
5105 if $u$ is the null value, $e$ evaluates to the null value. | |
5106 Otherwise let $x$ be a fresh variable bound to $u$. | |
5107 Evaluate \code{$x$.$v$++} to an object $o$. | |
5108 Then $e$ evaluates to $o$. | |
5109 | |
5110 \LMHash{} | |
5111 The static type of such an expression is the static type of \code{$e_1$.$v$}. | |
5112 | |
5113 \LMHash{} | |
5114 Evaluation of a postfix expression $e$ of the form \code{$e_1$?.$v$-{}-} | |
5115 where $e_1$ is not a type literal, proceeds as follows: | |
5116 | |
5117 If $e_1$ is a type literal, $e$ is equivalent to \code{$e_1$.$v$-{}-}. | |
5118 | |
5119 Otherwise evaluate $e_1$ to an object $u$. | |
5120 If $u$ is the null value, $e$ evalkuates to the null value. | |
5121 Otherwise let $x$ be a fresh variable bound to $u$. | |
5122 Evaluate \code{$x$.$v$-{}-} to an object $o$. | |
5123 Then $e$ evaluates to $o$. | |
5124 | |
5125 | |
5126 \LMHash{} | |
5127 The static type of such an expression is the static type of \code{$e_1$.$v$}. | |
4953 | 5128 |
4954 | 5129 |
4955 \subsection{ Assignable Expressions} | 5130 \subsection{ Assignable Expressions} |
4956 \LMLabel{assignableExpressions} | 5131 \LMLabel{assignableExpressions} |
4957 | 5132 |
4958 \LMHash{} | 5133 \LMHash{} |
4959 Assignable expressions are expressions that can appear on the left hand side of an assignment. | 5134 Assignable expressions are expressions that can appear on the left hand side of an assignment. |
4960 This section describes how to evaluate these expressions when they do not consti tute the complete left hand side of an assignment. | 5135 This section describes how to evaluate these expressions when they do not consti tute the complete left hand side of an assignment. |
4961 | 5136 |
4962 \rationale{ | 5137 \rationale{ |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5210 \LMHash{} | 5385 \LMHash{} |
5211 Evaluation of the cast expression \code{$e$ \AS{} $T$} proceeds as follows: | 5386 Evaluation of the cast expression \code{$e$ \AS{} $T$} proceeds as follows: |
5212 | 5387 |
5213 \LMHash{} | 5388 \LMHash{} |
5214 The expression $e$ is evaluated to a value $v$. Then, if $T$ is a malformed or d eferred type (\ref{staticTypes}), a dynamic error occurs. Otherwise, if the inte rface of the class of $v$ is a subtype of $T$, the cast expression evaluates to $v$. Otherwise, if $v$ is \NULL{}, the cast expression evaluates to $v$. | 5389 The expression $e$ is evaluated to a value $v$. Then, if $T$ is a malformed or d eferred type (\ref{staticTypes}), a dynamic error occurs. Otherwise, if the inte rface of the class of $v$ is a subtype of $T$, the cast expression evaluates to $v$. Otherwise, if $v$ is \NULL{}, the cast expression evaluates to $v$. |
5215 In all other cases, a \code{CastError} is thrown. | 5390 In all other cases, a \code{CastError} is thrown. |
5216 | 5391 |
5217 \LMHash{} | 5392 \LMHash{} |
5218 The static type of a cast expression \code{$e$ \AS{} $T$} is $T$. | 5393 The static type of a cast expression \code{$e$ \AS{} $T$} is $T$. |
5219 | 5394 |
5220 | |
5221 \section{Statements} | 5395 \section{Statements} |
5222 \LMLabel{statements} | 5396 \LMLabel{statements} |
5223 | 5397 |
5224 \begin{grammar} | 5398 \begin{grammar} |
5225 {\bf statements:} | 5399 {\bf statements:} |
5226 statement* | 5400 statement* |
5227 . | 5401 . |
5228 | 5402 |
5229 | 5403 |
5230 {\bf statement:} | 5404 {\bf statement:} |
(...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5942 \begin{itemize} | 6116 \begin{itemize} |
5943 \item | 6117 \item |
5944 if there is a dynamically enclosing error handler $g$ defined by a \FINALLY{} c lause in $m$, control is transferred to $g$. | 6118 if there is a dynamically enclosing error handler $g$ defined by a \FINALLY{} c lause in $m$, control is transferred to $g$. |
5945 \item | 6119 \item |
5946 Otherwise $m$ terminates. | 6120 Otherwise $m$ terminates. |
5947 \end{itemize} | 6121 \end{itemize} |
5948 | 6122 |
5949 Otherwise, execution resumes at the end of the try statement. | 6123 Otherwise, execution resumes at the end of the try statement. |
5950 | 6124 |
5951 \LMHash{} | 6125 \LMHash{} |
5952 Execution of an \ON{}-\CATCH{} clause \code{\ON{} $T$ \CATCH{} ($p_1$, $p_2$)} $ s$ of a try statement $t$ proceeds as follows: The statement $s$ is executed in the dynamic scope of the exception handler defined by the finally clause of $t$. Then, the current exception and active stack trace both become undefined. | 6126 Execution of an \ON{}-\CATCH{} clause \code{\ON{} $T$ \CATCH{} ($p_1$, $p_2$)} $ s$ of a try statement $t$ proceeds as follows: |
6127 The statement $s$ is executed in the dynamic scope of the exception handler defi ned by the finally clause of $t$. Then, the current exception and active stack t race both become undefined. | |
5953 | 6128 |
5954 \LMHash{} | 6129 \LMHash{} |
5955 Execution of a \FINALLY{} clause \FINALLY{} $s$ of a try statement proceeds as f ollows: | 6130 Execution of a \FINALLY{} clause \FINALLY{} $s$ of a try statement proceeds as f ollows: |
5956 | 6131 |
5957 \LMHash{} | 6132 \LMHash{} |
5958 Let $x$ be the current exception and let $t$ be the active stack trace. Then the current exception and the active stack trace both become undefined. The stateme nt $s$ is executed. Then, if $x$ is defined, it is rethrown as if by a rethrow statement (\ref{rethrow}) enclosed in a \CATCH{} clause of the form \code{\CATCH {} ($v_x$, $v_t$)} where $v_x$ and $v_t$ are fresh variables bound to $x$ and $t $ respectively. | 6133 Let $x$ be the current exception and let $t$ be the active stack trace. Then the current exception and the active stack trace both become undefined. The stateme nt $s$ is executed. Then, if $x$ is defined, it is rethrown as if by a rethrow statement (\ref{rethrow}) enclosed in a \CATCH{} clause of the form \code{\CATCH {} ($v_x$, $v_t$)} where $v_x$ and $v_t$ are fresh variables bound to $x$ and $t $ respectively. |
5959 | 6134 |
5960 | 6135 |
5961 \LMHash{} | 6136 \LMHash{} |
5962 Execution of a try statement of the form \code{\TRY{} $s_1$ $on-catch_1 \ldots o n-catch_n$ \FINALLY{} $s_f$;} proceeds as follows: | 6137 Execution of a try statement of the form \code{\TRY{} $s_1$ $on-catch_1 \ldots o n-catch_n$ \FINALLY{} $s_f$;} proceeds as follows: |
(...skipping 1736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7699 | 7874 |
7700 The invariant that each normative paragraph is associated with a line | 7875 The invariant that each normative paragraph is associated with a line |
7701 containing the text \LMHash{} should be maintained. Extra occurrences | 7876 containing the text \LMHash{} should be maintained. Extra occurrences |
7702 of \LMHash{} can be added if needed, e.g., in order to make | 7877 of \LMHash{} can be added if needed, e.g., in order to make |
7703 individual \item{}s in itemized lists addressable. Each \LM.. command | 7878 individual \item{}s in itemized lists addressable. Each \LM.. command |
7704 must occur on a separate line. \LMHash{} must occur immediately | 7879 must occur on a separate line. \LMHash{} must occur immediately |
7705 before the associated paragraph, and \LMLabel must occur immediately | 7880 before the associated paragraph, and \LMLabel must occur immediately |
7706 after the associated \section{}, \subsection{} etc. | 7881 after the associated \section{}, \subsection{} etc. |
7707 | 7882 |
7708 ---------------------------------------------------------------------- | 7883 ---------------------------------------------------------------------- |
OLD | NEW |