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 910 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
921 It is a compile-time error if a class has an instance member and a static member with the same name. | 921 It is a compile-time error if a class has an instance member and a static member with the same name. |
922 % It is a compile-time error if a generic (\ref{generics}) class declares a memb er with the same name as one of its type parameters. | 922 % It is a compile-time error if a generic (\ref{generics}) class declares a memb er with the same name as one of its type parameters. |
923 | 923 |
924 \commentary{Here are simple examples, that illustrate the difference between ``h as a member'' and ``declares a member''. For example, \code{B} {\em declares} on e member named \code{f}, but {\em has} two such members. The rules of inheritanc e determine what members a class has. | 924 \commentary{Here are simple examples, that illustrate the difference between ``h as a member'' and ``declares a member''. For example, \code{B} {\em declares} on e member named \code{f}, but {\em has} two such members. The rules of inheritanc e determine what members a class has. |
925 } | 925 } |
926 | 926 |
927 \begin{dartCode} | 927 \begin{dartCode} |
928 \CLASS{} A \{ | 928 \CLASS{} A \{ |
929 \VAR{} i = 0; | 929 \VAR{} i = 0; |
930 \VAR{} j; | 930 \VAR{} j; |
931 f(x) =$>$ 3; | 931 f(x) $=$> 3; |
eernst
2016/11/09 11:35:37
Oops, that wouldn't work! `$>$` may be needed (rat
Lasse Reichstein Nielsen
2016/11/09 12:31:56
Ack, yes, that's just me not reading what the orig
| |
932 \} | 932 \} |
933 | 933 |
934 \CLASS{} B \EXTENDS{} A \{ | 934 \CLASS{} B \EXTENDS{} A \{ |
935 int i = 1; // getter i and setter i= override versions from A | 935 int i = 1; // getter i and setter i= override versions from A |
936 \STATIC{} j; // compile-time error: static getter \& setter conflict with | 936 \STATIC{} j; // compile-time error: static getter \& setter conflict with |
937 //instance getter \& setter | 937 //instance getter \& setter |
938 | 938 |
939 /* compile-time error: static method conflicts with instance method */ | 939 /* compile-time error: static method conflicts with instance method */ |
940 \STATIC{} f(x) =$>$ 3; | 940 \STATIC{} f(x) $=$> 3; |
eernst
2016/11/09 11:35:37
`$>$`
Lasse Reichstein Nielsen
2016/11/09 12:31:56
Acknowledged.
| |
941 \} | 941 \} |
942 \end{dartCode} | 942 \end{dartCode} |
943 | 943 |
944 \LMHash{} | 944 \LMHash{} |
945 It is a compile time error if a class $C$ declares a member with the same name a s $C$. It is a compile time error if a generic class declares a type variable wi th the same name as the class or any of its members or constructors. | 945 It is a compile time error if a class $C$ declares a member with the same name a s $C$. It is a compile time error if a generic class declares a type variable wi th the same name as the class or any of its members or constructors. |
946 | 946 |
947 \subsection{Instance Methods} | 947 \subsection{Instance Methods} |
948 \LMLabel{instanceMethods} | 948 \LMLabel{instanceMethods} |
949 | 949 |
950 \LMHash{} | 950 \LMHash{} |
(...skipping 2863 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3814 \LMHash{} | 3814 \LMHash{} |
3815 Method invocation can take several forms as specified below. | 3815 Method invocation can take several forms as specified below. |
3816 | 3816 |
3817 \subsubsection{Ordinary Invocation} | 3817 \subsubsection{Ordinary Invocation} |
3818 \LMLabel{ordinaryInvocation} | 3818 \LMLabel{ordinaryInvocation} |
3819 | 3819 |
3820 \LMHash{} | 3820 \LMHash{} |
3821 An ordinary method invocation can be {\em conditional} or {\em unconditional}. | 3821 An ordinary method invocation can be {\em conditional} or {\em unconditional}. |
3822 | 3822 |
3823 \LMHash{} | 3823 \LMHash{} |
3824 Evaluation of a {\em conditional ordinary method invocation} $e$ of the form | 3824 Evaluation of a {\em conditional ordinary method invocation} $i$ of the form |
3825 | 3825 |
3826 \LMHash{} | 3826 \LMHash{} |
3827 $o?.m(a_1, \ldots , a_n, x_{n+1}: a_{n+1}, \ldots , x_{n+k}: a_{n+k})$ | 3827 $e?.m(a_1, \ldots , a_n, x_{n+1}: a_{n+1}, \ldots , x_{n+k}: a_{n+k})$ |
3828 | 3828 |
3829 \LMHash{} | 3829 \LMHash{} |
3830 is equivalent to the evaluation of the expression | 3830 proceeds as follows: |
3831 | 3831 |
3832 \LMHash{} | 3832 \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)$. | 3833 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 | 3834 |
3837 \LMHash{} | 3835 \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})$. | 3836 Otherwise, evaluate $e$ to an object $o$. |
3837 If $o$ is the null value, $i$ evaluates to the null value. | |
3838 Otherwise let $v$ be a fresh variable bound to $o$ and evaluate | |
3839 \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$. | |
3840 | |
3841 | |
3842 \LMHash{} | |
3843 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 | 3844 |
3840 \LMHash{} | 3845 \LMHash{} |
3841 An {\em unconditional ordinary method invocation} $i$ has the form | 3846 An {\em unconditional ordinary method invocation} $i$ has the form |
3842 | 3847 |
3843 $o.m(a_1, \ldots , a_n, x_{n+1}: a_{n+1}, \ldots , x_{n+k}: a_{n+k})$. | 3848 $e.m(a_1, \ldots , a_n, x_{n+1}: a_{n+1}, \ldots , x_{n+k}: a_{n+k})$. |
3844 | 3849 |
3845 \LMHash{} | 3850 \LMHash{} |
3846 Evaluation of an unconditional ordinary method invocation $i$ of the form | 3851 Evaluation of an unconditional ordinary method invocation $i$ of the form |
3847 | 3852 |
3848 $o.m(a_1, \ldots , a_n, x_{n+1}: a_{n+1}, \ldots , x_{n+k}: a_{n+k})$ | 3853 $e.m(a_1, \ldots , a_n, x_{n+1}: a_{n+1}, \ldots , x_{n+k}: a_{n+k})$ |
3849 | 3854 |
3850 proceeds as follows: | 3855 proceeds as follows: |
3851 | 3856 |
3852 \LMHash{} | 3857 \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$. | 3858 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 | 3859 |
3855 \LMHash{} | 3860 \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$. | 3861 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 | 3862 |
3858 \commentary{ | 3863 \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. | 3864 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 } | 3865 } |
3861 | 3866 |
3862 \LMHash{} | 3867 \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. | 3868 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 | 3869 |
3865 \LMHash{} | 3870 \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. | 3871 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 | 3872 |
3868 \LMHash{} | 3873 \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$. | 3874 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. | 3875 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 | 3876 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}\}$. | 3877 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 | 3878 |
3874 \LMHash{} | 3879 \LMHash{} |
3875 If getter lookup has also failed, then a new instance $im$ of the predefined cla ss \code{Invocation} is created, such that: | 3880 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} | 3881 \begin{itemize} |
3877 \item \code{im.isMethod} evaluates to \code{\TRUE{}}. | 3882 \item \code{im.isMethod} evaluates to \code{\TRUE{}}. |
3878 \item \code{im.memberName} evaluates to the symbol \code{m}. | 3883 \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$]}. | 3884 \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}$\}}. | 3885 \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} | 3886 \end{itemize} |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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$. | 3923 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$. |
3919 | 3924 |
3920 \LMHash{} | 3925 \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 `.'. | 3926 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 | 3927 |
3923 | 3928 |
3924 \subsubsection{Cascaded Invocations} | 3929 \subsubsection{Cascaded Invocations} |
3925 \LMLabel{cascadedInvocations} | 3930 \LMLabel{cascadedInvocations} |
3926 | 3931 |
3927 \LMHash{} | 3932 \LMHash{} |
3928 A {\em cascaded method invocation} has the form {\em e..suffix} | 3933 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. | 3934 where $e$ is an expression and \metavar{suffix} is a sequence of operator, metho d, getter or setter invocations. |
3930 | 3935 |
3931 \begin{grammar} | 3936 \begin{grammar} |
3932 {\bf cascadeSection:} | 3937 {\bf cascadeSection:} |
3933 `{\escapegrammar ..}' (cascadeSelector arguments*) (assignableSelector arg uments*)* (assignmentOperator expressionWithoutCascade)? | 3938 `{\escapegrammar ..}' (cascadeSelector arguments*) (assignableSelector arg uments*)* (assignmentOperator expressionWithoutCascade)? |
3934 . | 3939 . |
3935 | 3940 |
3936 {\bf cascadeSelector:}`[' expression `]'; | 3941 {\bf cascadeSelector:}`[' expression `]'; |
3937 identifier | 3942 identifier |
3938 . | 3943 . |
3939 \end{grammar} | 3944 \end{grammar} |
3940 | 3945 |
3941 \LMHash{} | 3946 \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$)}. | 3947 Evaluation of a cascaded method invocation expression $e$ of the form \code{$e$. .\metavar{suffix}} proceeds as follows: |
3948 | |
3949 Evaluate $e$ to an object $o$. | |
3950 Let $t$ be a fresh variable bound to $o$. | |
3951 Evaluate \code{$t$.\metavar{suffix}} to an object. | |
3952 Then $e$ evaluates to $o$. | |
3943 | 3953 |
3944 \rationale{ | 3954 \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$)}. | 3955 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 \code{t} is a fresh variable bound to the value of $e$. |
eernst
2016/11/09 11:35:37
`where $t$ is`
Lasse Reichstein Nielsen
2016/11/09 12:31:55
Done.
| |
3946 | 3956 |
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}. | 3957 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 } | 3958 } |
3949 | 3959 |
3950 \subsubsection{Super Invocation} | 3960 \subsubsection{Super Invocation} |
3951 \LMLabel{superInvocation} | 3961 \LMLabel{superInvocation} |
3952 | 3962 |
3953 \LMHash{} | 3963 \LMHash{} |
3954 A super method invocation $i$ has the form | 3964 A super method invocation $i$ has the form |
3955 | 3965 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4022 \begin{enumerate} | 4032 \begin{enumerate} |
4023 \item A {\em closurization} which converts a method or constructor into a closur e. Or | 4033 \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. | 4034 \item A {\em getter invocation} which returns the result of invoking of a getter method. |
4025 \end{enumerate} | 4035 \end{enumerate} |
4026 | 4036 |
4027 | 4037 |
4028 \commentary{Closures derived from members via closurization are colloquially kno wn as tear-offs} | 4038 \commentary{Closures derived from members via closurization are colloquially kno wn as tear-offs} |
4029 | 4039 |
4030 Property extraction can be either {\em conditional} or {\em unconditional}. | 4040 Property extraction can be either {\em conditional} or {\em unconditional}. |
4031 | 4041 |
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)$. | 4042 \LMHash{} |
4033 unless $e_1$ is a type literal, in which case it is equivalent to $e_1.m$. | 4043 Evaluation of a {\em conditional property extraction expression} $e$ |
4044 of the form \code{$e_1$?.\metavar{id}} proceeds as follows: | |
4034 | 4045 |
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$. | 4046 \LMHash{} |
4047 If $e_1$ is a type literal, $e$ is equivalent to $e_1.m$. | |
eernst
2016/11/09 11:35:37
I believe it has to be `\code{$e_1$.\metavar{id}}`
Lasse Reichstein Nielsen
2016/11/09 12:31:56
Done.
| |
4048 | |
4049 \LMHash{} | |
4050 Otherwise evaluate $e_1$ to an object $o$. | |
4051 If $o$ is the null value, $e$ evaluates to the null value. | |
4052 Otherwise let $x$ be a fresh variable bound to $o$ | |
4053 and evaluate \code{$x$.\metavar{id}} to a value $r$. | |
4054 Then $e$ evaluates to $r$. | |
4055 | |
4056 | |
4057 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 | 4058 |
4037 \LMHash{} | 4059 \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. | 4060 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 | 4061 |
4040 \subsubsection{Getter Access and Method Extraction} | 4062 \subsubsection{Getter Access and Method Extraction} |
4041 \LMLabel{getterAccessAndMethodExtraction} | 4063 \LMLabel{getterAccessAndMethodExtraction} |
4042 | 4064 |
4043 \LMHash{} | 4065 \LMHash{} |
4044 Evaluation of a property extraction $i$ of the form $e.m$ proceeds as follows: | 4066 Evaluation of a property extraction $i$ of the form $e.m$ proceeds as follows: |
4045 | 4067 |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4156 \} | 4178 \} |
4157 \end{dartCode} | 4179 \end{dartCode} |
4158 if $f$ is named $m$ and has required parameters $r_1, \ldots, r_n$, and named pa rameters $p_1, \ldots, p_k$ with defaults $d_1, \ldots, d_k$. | 4180 if $f$ is named $m$ and has required parameters $r_1, \ldots, r_n$, and named pa rameters $p_1, \ldots, p_k$ with defaults $d_1, \ldots, d_k$. |
4159 \item | 4181 \item |
4160 \begin{dartCode} | 4182 \begin{dartCode} |
4161 $(r_1, \ldots, r_n, [p_1 = d_1, \ldots , p_k = d_k])$\{ | 4183 $(r_1, \ldots, r_n, [p_1 = d_1, \ldots , p_k = d_k])$\{ |
4162 \RETURN{} $u.m(r_1, \ldots, r_n, p_1, \ldots, p_k)$; | 4184 \RETURN{} $u.m(r_1, \ldots, r_n, p_1, \ldots, p_k)$; |
4163 \} | 4185 \} |
4164 \end{dartCode} | 4186 \end{dartCode} |
4165 if $f$ is named $m$ and has required parameters $r_1, \ldots, r_n$, and optional positional parameters $p_1, \ldots, p_k$ with defaults $d_1, \ldots, d_k$. | 4187 if $f$ is named $m$ and has required parameters $r_1, \ldots, r_n$, and optional positional parameters $p_1, \ldots, p_k$ with defaults $d_1, \ldots, d_k$. |
4166 %\end{itemize} | 4188 \end{itemize} |
4167 | 4189 |
4168 \LMHash{} | 4190 \LMHash{} |
4169 Except that iff \code{identical($o_1, o_2$)} then \cd{$o_1.m$ == $o_2.m$}. | 4191 Except that iff \code{identical($o_1, o_2$)} then \cd{$o_1.m$ == $o_2.m$}. |
4170 %\item The static type of the property extraction is the static type of function $T.m$, where $T$ is the static type of $e$, if $T.m$ is defined. Otherwise the static type of $e.m$ is \DYNAMIC{}. | 4192 %\item The static type of the property extraction is the static type of function $T.m$, where $T$ is the static type of $e$, if $T.m$ is defined. Otherwise the static type of $e.m$ is \DYNAMIC{}. |
4171 | 4193 |
4172 \commentary{ | 4194 \commentary{ |
4173 There is no guarantee that \cd{identical($o_1.m, o_2.m$)}. Dart implementations are not required to canonicalize these or any other closures. | 4195 There is no guarantee that \cd{identical($o_1.m, o_2.m$)}. Dart implementations are not required to canonicalize these or any other closures. |
4174 } | 4196 } |
4175 % local functions that have a closure extracted are always different | 4197 % local functions that have a closure extracted are always different |
4176 | 4198 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4256 \LMHash{} | 4278 \LMHash{} |
4257 Otherwise, the assignment is equivalent to the assignment \code{ \THIS{}.$v$ = $ e$}. | 4279 Otherwise, the assignment is equivalent to the assignment \code{ \THIS{}.$v$ = $ e$}. |
4258 | 4280 |
4259 \LMHash{} | 4281 \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$. | 4282 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 | 4283 |
4262 \LMHash{} | 4284 \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$. | 4285 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 | 4286 |
4265 \LMHash{} | 4287 \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 )$ | 4288 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$. | 4289 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$. | 4290 |
4291 \LMHash | |
4292 If $e_1$ is a type literal, $a$ is equivalent to \code{$e_1$.$v$ = $e_2$}. | |
4269 | 4293 |
4270 \LMHash{} | 4294 \LMHash{} |
4271 Evaluation of an assignment of the form $e_1.v$ \code{=} $e_2$ proceeds as follo ws: | 4295 Otherwise evaluate $e_1$ to an object $o$. |
4296 If $o$ is the null value, $a$ evaluates to the null value. | |
4297 Otherwise let $x$ be a fresh variable bound to $o$ | |
4298 and evaluate \code{$x$.$v$ = $e_2$} to an object $r$. | |
4299 Then $a$ evaluates to $r$. | |
4300 | |
4301 \LMHash{} | |
4302 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$}. | |
4303 | |
4304 \LMHash{} | |
4305 Evaluation of an assignment of the form \code{$e_1$.$v$ = $e_2$} proceeds as fol lows: | |
4272 | 4306 |
4273 \LMHash{} | 4307 \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$. | 4308 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 | 4309 |
4276 \LMHash{} | 4310 \LMHash{} |
4277 If the setter lookup has failed, then a new instance $im$ of the predefined cla ss \code{Invocation} is created, such that : | 4311 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} | 4312 \begin{itemize} |
4279 \item \code{im.isSetter} evaluates to \code{\TRUE{}}. | 4313 \item \code{im.isSetter} evaluates to \code{\TRUE{}}. |
4280 \item \code{im.memberName} evaluates to the symbol \code{v=}. | 4314 \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$]}. | 4315 \item \code{im.positionalArguments} evaluates to an immutable list with the same values as \code{[$o_2$]}. |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4347 | 4381 |
4348 \LMHash{} | 4382 \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$. | 4383 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 | 4384 |
4351 | 4385 |
4352 | 4386 |
4353 | 4387 |
4354 | 4388 |
4355 | 4389 |
4356 \LMHash{} | 4390 \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$. | 4391 Evaluation of an assignment $e$ of the form \code{$e_1$[$e_2$] = $e_3$} |
4392 proceeds as follows: | |
4393 | |
eernst
2016/11/09 11:35:38
Add a new line with `\LMHash{}` after this line.
Lasse Reichstein Nielsen
2016/11/09 12:31:56
Done.
| |
4394 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$. | |
4395 Call the method \code{[]=} on $a$ with $i$ as first argument and $v$ as second a rgument. | |
4396 Then $e$ evaluates to $v$. | |
4397 | |
eernst
2016/11/09 11:35:37
Add an `\LMHash{}` line.
Lasse Reichstein Nielsen
2016/11/09 12:31:55
Done.
| |
4398 The static type of the expression \code{$e_1$[$e_2$] = $e_3$} is the static type of $e_3$. | |
4358 | 4399 |
4359 \LMHash{} | 4400 \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$. | 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 $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$, | |
eernst
2016/11/09 11:35:38
Might as well use `$C$.$v$` now that so many other
Lasse Reichstein Nielsen
2016/11/09 12:31:56
Done.
| |
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: | |
4441 | |
eernst
2016/11/09 11:35:37
`\LMHash{}`
Lasse Reichstein Nielsen
2016/11/09 12:31:55
Done.
| |
4442 Evaluate $e_1$ to an object $u$. | |
4443 Let $x$ be a fresh variable bound to $u$. | |
4444 Evalute \code{$x$.$v$} to an object $o$. | |
4445 If $o$ is not the null value, $a$ evaluates to $o$. | |
4446 Otherwise evaluate \code{$x$.$v$ = $e_2$} to an object $r$, | |
4447 and then $a$ evaluates to $r$. | |
4388 | 4448 |
4389 \LMHash{} | 4449 \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 | 4450 Evaluation of a compound assignment $a$ of the form \code{$e_1$[$e_2$] ??= $e_3$ } |
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$. | 4451 proceeds as follows: |
4452 | |
eernst
2016/11/09 11:35:37
`\LMHash{}`
Lasse Reichstein Nielsen
2016/11/09 12:31:56
Done.
| |
4453 Evaluate $e_1$ to an object $u$ and then evaluate $e_2$ to an object $i$. | |
4454 Call the \code{[]} method on $u$ with argument $i$, and let $o$ be the returned value. | |
4455 If $o$ is not the null value, $a$ evaluates to $o$. | |
4456 Otherwise evaluate $e_3$ to an object $v$ | |
4457 and then call the \code{[]=} method on $u$ with $i$ as first argument and $v$ as second argument. | |
4458 Then $a$ evaluates to $v$. | |
4392 | 4459 |
4393 \LMHash{} | 4460 \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$. | 4461 Evaluation of a compound assignment $a$ of the form \code{\SUPER.$v$ ??= $e$} |
4462 proceeds as follows: | |
4463 | |
eernst
2016/11/09 11:35:36
`\LMHash{}`
Lasse Reichstein Nielsen
2016/11/09 12:31:56
Done.
| |
4464 Evaluate \code{\SUPER.$v$} to an object $o$. | |
4465 If $o$ is not the null value then $a$ evaluats to $o$. | |
4466 Otherwise evaluate \code{\SUPER.$v$ = $e$} to an object $r$, | |
4467 and then $a$ evaluates to $r$. | |
4395 | 4468 |
4396 \LMHash{} | 4469 \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$. | 4470 Evaluation of a compound assignment $a$ of the form \code{$e_1$?.$v$ ??= $e_2$} |
4471 proceeds as follows: | |
4472 | |
eernst
2016/11/09 11:35:37
`\LMHash{}`
Lasse Reichstein Nielsen
2016/11/09 12:31:55
Done.
| |
4473 Evaluate $e_1$ to an object $u$ and let $x$ be a fresh variable bound to $u$. | |
4474 Evaluate \code{$x$.$v$} to an object $o$. | |
4475 If $o$ is not the null value then $a$ evaluates to $o$. | |
4476 Otherwise evaluate \code{$x$.$v$ = $e_2$} to an object $r$, | |
4477 and then $a$ evaluates to $r$. | |
4478 | |
4398 % But what about C?.v ??= e | 4479 % But what about C?.v ??= e |
4399 | 4480 |
4400 \LMHash{} | 4481 \LMHash{} |
4401 A compound assignment of the form $C?.v$ {\em ??=} $e_2$ is equivalent to the e xpression $C.v$ {\em ??=} $e$. | 4482 A compound assignment of the form $C?.v$ {\em ??=} $e_2$ is equivalent to the e xpression $C.v$ {\em ??=} $e$. |
4402 | 4483 |
4403 \LMHash{} | 4484 \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$. | 4485 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 | 4486 |
4406 | 4487 |
4407 \LMHash{} | 4488 \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$. | 4489 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 | 4490 |
4410 \LMHash{} | 4491 \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$. | 4492 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 | 4493 |
4413 \LMHash{} | 4494 \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$. | 4495 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 | 4496 |
4416 \LMHash{} | 4497 \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$. | 4498 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 | 4499 |
4419 \LMHash{} | 4500 \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 | 4501 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$. | 4502 |
eernst
2016/11/09 11:35:37
`\LMHash{}`
Lasse Reichstein Nielsen
2016/11/09 12:31:55
Done.
| |
4503 Evaluation of a compound assignment $a$ of the form \code{$e_1$.$v$ $op$= $e_2$} proceeds as follows: | |
4504 Evaluate $e_1$ to an object $u$ and let $x$ be a fresh variable bound to $u$. | |
4505 Evaluate \code{$x$.$v$ = $x$.$v$ $op$ $e_2$} to an object $r$ | |
4506 and then $a$ evaluates to $r$. | |
4507 | |
eernst
2016/11/09 11:35:38
`\LMHash{}`
Lasse Reichstein Nielsen
2016/11/09 12:31:56
Done.
| |
4508 Evaluation of s compound assignment $a$ of the form \code{$e_1$[$e_2$] $op$= $e_ 3$} proceeds as follows: | |
4509 Evaluate $e_1$ to an object $u$ and evaluate $e_2$ to an object $v$. | |
4510 Let $a$ and $i$ be fresh variables bound to $u$ and $v$ respectively. | |
4511 Evaluate \code{$a$[$i$] = $a$[$i$] $op$ $e_3$} to an object $r$, | |
4512 and then $a$ evaluates to $r$. | |
4422 | 4513 |
4423 \LMHash{} | 4514 \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$. | 4515 Evaluation of a compound assignment $a$ of the form \code{$e_1$?.$v$ $op$ = $e_2 $} proceeds as follows: |
4516 | |
eernst
2016/11/09 11:35:38
`\LMHash{}`
Lasse Reichstein Nielsen
2016/11/09 12:31:55
Done.
| |
4517 Evaluate $e_1$ to an object $u$. | |
4518 If $u$ is the null value, then $a$ evaluates to the null value. | |
4519 Otherwise let $x$ be a fresh variable bound to $u$. | |
4520 Evaluate \code{$x$.$v$ $op$= $e_2$} to an object $r$. | |
4521 Then $a$ evaluates to $r$. | |
4522 | |
eernst
2016/11/09 11:35:37
`\LMHash{}`
Lasse Reichstein Nielsen
2016/11/09 12:31:56
Done.
| |
4523 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 | 4524 |
4426 \LMHash{} | 4525 \LMHash{} |
4427 A compound assignment of the form $C?.v$ $op = e_2$ is equivalent to the express ion | 4526 A compound assignment of the form $C?.v$ $op = e_2$ is equivalent to the express ion |
4428 $C.v$ $op = e_2$. | 4527 $C.v$ $op = e_2$. |
4429 | 4528 |
4430 \begin{grammar} | 4529 \begin{grammar} |
4431 {\bf compoundAssignmentOperator:}`*='; | 4530 {\bf compoundAssignmentOperator:}`*='; |
4432 `/='; | 4531 `/='; |
4433 `\~{}/='; | 4532 `\~{}/='; |
4434 `\%='; | 4533 `\%='; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4482 | 4581 |
4483 \LMHash{} | 4582 \LMHash{} |
4484 An {\em if-null expression}evaluates an expression and if the result is \NULL, evaluates another. | 4583 An {\em if-null expression}evaluates an expression and if the result is \NULL, evaluates another. |
4485 | 4584 |
4486 \begin{grammar} | 4585 \begin{grammar} |
4487 {\bf ifNullExpression:} | 4586 {\bf ifNullExpression:} |
4488 logicalOrExpression (`??' logicalOrExpression)* | 4587 logicalOrExpression (`??' logicalOrExpression)* |
4489 \end{grammar} | 4588 \end{grammar} |
4490 | 4589 |
4491 \LMHash{} | 4590 \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$. | 4591 Evaluation of an if-null expression $e$ of the form \code{$e_1$ ?? $e_2$} |
4592 proceeds as follows: | |
4593 | |
eernst
2016/11/09 11:35:37
`\LMHash{}`
Lasse Reichstein Nielsen
2016/11/09 12:31:56
Done.
| |
4594 Evaluate $e_1$ to an object $o$. | |
4595 If $o$ is not the null value, then $e$ evaluates to $o$. | |
4596 Otherwise evaluate $e_2$ to an object $r$, | |
4597 and then $e$ evaluates to $r$. | |
4598 | |
eernst
2016/11/09 11:35:38
`\LMHash{}`
Lasse Reichstein Nielsen
2016/11/09 12:31:56
Done.
| |
4599 The static type of $e$ is least upper bound (\ref{leastUpperBounds}) of the stat ic type of $e_1$ and the static type of $e_2$. | |
eernst
2016/11/09 11:35:38
`is least` --> `is the least`
Lasse Reichstein Nielsen
2016/11/09 12:31:56
Done.
| |
4493 | 4600 |
4494 | 4601 |
4495 \subsection{ Logical Boolean Expressions} | 4602 \subsection{ Logical Boolean Expressions} |
4496 \LMLabel{logicalBooleanExpressions} | 4603 \LMLabel{logicalBooleanExpressions} |
4497 | 4604 |
4498 \LMHash{} | 4605 \LMHash{} |
4499 The logical boolean expressions combine boolean objects using the boolean conjun ction and disjunction operators. | 4606 The logical boolean expressions combine boolean objects using the boolean conjun ction and disjunction operators. |
4500 | 4607 |
4501 \begin{grammar} | 4608 \begin{grammar} |
4502 {\bf logicalOrExpression:} | 4609 {\bf logicalOrExpression:} |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4853 {\bf incrementOperator:}`++'; | 4960 {\bf incrementOperator:}`++'; |
4854 `-{}-' | 4961 `-{}-' |
4855 . | 4962 . |
4856 | 4963 |
4857 \end{grammar} | 4964 \end{grammar} |
4858 | 4965 |
4859 \LMHash{} | 4966 \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$ . | 4967 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 | 4968 |
4862 \LMHash{} | 4969 \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\}()}. | 4970 Evaluation of a postfix expression $e$ of the form \code{$v$++}, where $v$ is an identifier, proceeds as follows: |
4971 | |
eernst
2016/11/09 11:35:37
`\LMHash{}`
Lasse Reichstein Nielsen
2016/11/09 12:31:56
Done.
| |
4972 Evaluate $v$ to an object $r$ and let $y$ be a fresh variable bound to $r$. | |
4973 Evaluate \code{$v$ = $y$ + 1}. | |
4974 Then $e$ evaluates to $r$. | |
4864 | 4975 |
4865 \LMHash{} | 4976 \LMHash{} |
4866 The static type of such an expression is the static type of $v$. | 4977 The static type of such an expression is the static type of $v$. |
4867 | 4978 |
4868 | 4979 |
4869 \rationale{The above ensures that if $v$ is a field, the getter gets called exac tly once. Likewise in the cases below. | 4980 \rationale{The above ensures that if $v$ is a field, the getter gets called exac tly once. Likewise in the cases below. |
4870 } | 4981 } |
4871 | 4982 |
4872 \LMHash{} | 4983 \LMHash{} |
4873 Execution of a postfix expression of the form \code{$C.v$ ++} is equivalent to e xecuting | 4984 Evaluation of a postfix expression $e$ of the form \code{$C$.$v$++} |
4985 proceeds as follows: | |
4874 | 4986 |
eernst
2016/11/09 11:35:37
`\LMHash{}`
Lasse Reichstein Nielsen
2016/11/09 12:31:56
Done.
| |
4875 \code{()\{\VAR{} r = $C.v$; $C.v$ = r + 1; \RETURN{} r\}()}. | 4987 Evaluate $C.v$ to a value $r$ and let $y$ be a fresh variable bound to $r$. |
eernst
2016/11/09 11:35:38
Well, `\code{$C$.$v$}` would be the strictly consi
Lasse Reichstein Nielsen
2016/11/09 12:31:56
Done.
| |
4988 Evaluate \code{$C.v$ = $y$ + 1}. | |
eernst
2016/11/09 11:35:37
`$C$.$v$`
Lasse Reichstein Nielsen
2016/11/09 12:31:56
Done.
| |
4989 Then $e$ evaluates to $r$. | |
4876 | 4990 |
4877 \LMHash{} | 4991 \LMHash{} |
4878 The static type of such an expression is the static type of $C.v$. | 4992 The static type of such an expression is the static type of \code{$C$.$v$}. |
4879 | 4993 |
4880 | 4994 |
4881 \LMHash{} | 4995 \LMHash{} |
4882 Execution of a postfix expression of the form \code{$e_1.v$++} is equivalent to executing | 4996 Evaluating of a postfix expression $e$ of the form \code{$e_1$.$v$++} |
eernst
2016/11/09 11:35:37
`Evaluating` --> `Evaluation`
Lasse Reichstein Nielsen
2016/11/09 12:31:55
Done.
| |
4997 proceeds as follows: | |
4883 | 4998 |
eernst
2016/11/09 11:35:37
`\LMHash{}`
Lasse Reichstein Nielsen
2016/11/09 12:31:55
Done.
| |
4884 \code{(x)\{\VAR{} r = x.v; x.v = r + 1; \RETURN{} r\}($e_1$)}. | 4999 Evaluate $e_1$ to an object $u$ and let $x$ be a fresh variable bound to $u$. |
5000 Evaluate \code{$x$.$v$} to a value $r$ | |
5001 and let $y$ be a fresh variable bound to $r$. | |
5002 Evaluate \code{$x$.$v$ = $y$ + 1}. | |
5003 Then $e$ evaluates to $r$. | |
4885 | 5004 |
4886 \LMHash{} | 5005 \LMHash{} |
4887 The static type of such an expression is the static type of $e_1.v$. | 5006 The static type of such an expression is the static type of \code{$e_1$.$v$}. |
4888 | 5007 |
4889 | 5008 |
4890 \LMHash{} | 5009 \LMHash{} |
4891 Execution of a postfix expression of the form \code{$e_1[e_2]$++}, is equivalen t to executing | 5010 Evaluation of a postfix expression $e$ of the form \code{$e_1$[$e_2$]++} |
5011 proceeds as follows: | |
4892 | 5012 |
eernst
2016/11/09 11:35:37
`\LMHash{}`
Lasse Reichstein Nielsen
2016/11/09 12:31:56
Done.
| |
4893 \code{(a, i)\{\VAR{} r = a[i]; a[i] = r + 1; \RETURN{} r\}($e_1$, $e_2$)}. | 5013 Evaluate $e_1$ to an object $u$ and $e_2$ to an object $v$. |
5014 Let $a$ and $i$ be fresh variables bound to $u$ and $v$ respectively. | |
5015 Evaluate \code{$a$[$i$]} to an object $r$ | |
5016 and let $y$ be a fresh variable bound to $r$. | |
5017 Evaluate \code{$a$[$i$] = $y$ + 1}. | |
5018 Then $e$ evaluates to $r$. | |
4894 | 5019 |
4895 \LMHash{} | 5020 \LMHash{} |
4896 The static type of such an expression is the static type of $e_1[e_2]$. | 5021 The static type of such an expression is the static type of \code{$e_1$[$e_2$]}. |
4897 | 5022 |
4898 | 5023 |
4899 \LMHash{} | 5024 \LMHash{} |
4900 Execution of a postfix expression of the form \code{$v$-{}-}, where $v$ is an id entifier, is equivalent to executing | 5025 Evaluation of a postfix expression $e$ of the form \code{$v$-{}-}, where $v$ is an identifier, proceeds as follows: |
4901 | 5026 |
eernst
2016/11/09 11:35:38
`\LMHash{}`
Lasse Reichstein Nielsen
2016/11/09 12:31:56
Done.
| |
4902 \code{()\{\VAR{} r = $v$; $v$ = r - 1; \RETURN{} r\}()}. | 5027 Evaluate the expression $v$ to an object $r$ |
5028 and let $y$ be a fresh variable bound to $r$. | |
5029 Evaluate \code{$v$ = $y$ - 1}. | |
5030 Then $e$ evaluates to $r$. | |
4903 | 5031 |
4904 \LMHash{} | 5032 \LMHash{} |
4905 The static type of such an expression is the static type of $v$. | 5033 The static type of such an expression is the static type of $v$. |
4906 | 5034 |
4907 | 5035 |
4908 \LMHash{} | 5036 \LMHash{} |
4909 Execution of a postfix expression of the form \code{$C.v$-{}-} is equivalent to executing | 5037 Evaluation of a postfix expression $e$ of the form \code{$C$.$v$-{}-} |
5038 proceeds as follows: | |
4910 | 5039 |
eernst
2016/11/09 11:35:37
`\LMHash{}`
Lasse Reichstein Nielsen
2016/11/09 12:31:56
Done.
| |
4911 \code{()\{\VAR{} r = $C.v$; $C.v$ = r - 1; \RETURN{} r\}()}. | 5040 Evaluate \code{$C$.$v$} to a value $r$ |
5041 and let $y$ be a fresh variable bound to $r$. | |
5042 Evaluate \code{$C$.$v$ = $y$ - 1}. | |
5043 Then $e$ evaluates to $r$. | |
4912 | 5044 |
4913 \LMHash{} | 5045 \LMHash{} |
4914 The static type of such an expression is the static type of $C.v$. | 5046 The static type of such an expression is the static type of \code{$C$.$v$}. |
4915 | 5047 |
4916 | 5048 |
4917 \LMHash{} | 5049 \LMHash{} |
4918 Execution of a postfix expression of the form \code{$e_1.v$-{}-} is equivalent t o executing | 5050 Evaluation of a postfix expression of the form \code{$e_1$.$v$-{}-} |
5051 proceeds as follows: | |
4919 | 5052 |
eernst
2016/11/09 11:35:37
`\LMHash{}`
Lasse Reichstein Nielsen
2016/11/09 12:31:56
Done.
| |
4920 \code{(x)\{\VAR{} r = x.v; x.v = r - 1; \RETURN{} r\}($e_1$)}. | 5053 Evaluate $e_1$ to an object $u$ and let $x$ be a fresh variable bound to $u$. |
4921 | 5054 Evaluate \code{$x$.$v$} to a value $r$ |
4922 \LMHash{} | 5055 and let $y$ be a fresh variable bound to $r$. |
4923 The static type of such an expression is the static type of $e_1.v$. | 5056 Evaluate \code{$x$.$v$ = $y$ - 1}. |
5057 Then $e$ evaluates to $r$. | |
4924 | 5058 |
4925 | 5059 |
4926 \LMHash{} | 5060 \LMHash{} |
4927 Execution of a postfix expression of the form \code{$e_1[e_2]$-{}-}, is equival ent to executing | 5061 The static type of such an expression is the static type of \code{$e_1$.$v$}. |
4928 | 5062 |
4929 \code{(a, i)\{\VAR{} r = a[i]; a[i] = r - 1; \RETURN{} r\}($e_1$, $e_2$)}. | |
4930 | 5063 |
4931 \LMHash{} | 5064 \LMHash{} |
4932 The static type of such an expression is the static type of $e_1[e_2]$. | 5065 Evaluation of a postfix expression $e$ of the form \code{$e_1$[$e_2$]-{}-} |
5066 proceeds as follows: | |
5067 | |
eernst
2016/11/09 11:35:37
`\LMHash{}`
Lasse Reichstein Nielsen
2016/11/09 12:31:55
Done.
| |
5068 Evaluate $e_1$ to an object $u$ and $e_2$ to an object $v$. | |
5069 Let $a$ and $i$ be fresh variables bound to $u$ and $v$ respectively. | |
5070 Evaluate \code{$a$[$i$]} to an object $r$ | |
5071 and let $y$ be a fresh variable bound to $r$. | |
5072 Evaluate \code{$a$[$i$] = $y$ - 1}. | |
5073 Then $e$ evaluates to $r$. | |
4933 | 5074 |
4934 \LMHash{} | 5075 \LMHash{} |
4935 Execution of a postfix expression of the form \code{$e_1?.v$++} is equivalent to executing | 5076 The static type of such an expression is the static type of \code{$e_1$[$e_2$]}. |
4936 | |
4937 \code{((x) =$>$ x == \NULL? \NULL : x.v++)($e_1$)} | |
4938 unless $e_1$ is a type literal, in which case it is equivalent to \code{$e_1.v$+ +} | |
4939 . | |
4940 | 5077 |
4941 \LMHash{} | 5078 \LMHash{} |
4942 The static type of such an expression is the static type of $e_1.v$. | 5079 Evaluation of a postfix expression $e$ of the form \code{$e_1$?.$v$++} |
5080 where $e_1$ is not a type literal, proceeds as follows: | |
5081 | |
eernst
2016/11/09 11:35:38
`\LMHash{}`
Lasse Reichstein Nielsen
2016/11/09 12:31:56
Done.
| |
5082 If $e_1$ is a type literal, $e$ is equivalent to \code{$e_1$.$v$++}. | |
5083 | |
eernst
2016/11/09 11:35:38
`\LMHash{}`
Lasse Reichstein Nielsen
2016/11/09 12:31:56
Done.
| |
5084 Otherwise evaluate $e_1$ to an object $u$. | |
5085 if $u$ is the null value, $e$ evaluates to the null value. | |
5086 Otherwise let $x$ be a fresh variable bound to $u$. | |
5087 Evaluate \code{$x$.$v$++} to an object $o$. | |
5088 Then $e$ evaluates to $o$. | |
4943 | 5089 |
4944 \LMHash{} | 5090 \LMHash{} |
4945 Execution of a postfix expression of the form \code{$e_1?.v$-{}-} is equivalent to executing | 5091 The static type of such an expression is the static type of \code{$e_1$.$v$}. |
4946 | |
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 | 5092 |
4951 \LMHash{} | 5093 \LMHash{} |
4952 The static type of such an expression is the static type of $e_1.v$. | 5094 Evaluation of a postfix expression $e$ of the form \code{$e_1$?.$v$-{}-} |
5095 where $e_1$ is not a type literal, proceeds as follows: | |
5096 | |
eernst
2016/11/09 11:35:37
`\LMHash{}`
Lasse Reichstein Nielsen
2016/11/09 12:31:56
Done.
| |
5097 If $e_1$ is a type literal, $e$ is equivalent to \code{$e_1$.$v$-{}-}. | |
5098 | |
eernst
2016/11/09 11:35:36
`\LMHash{}`
Lasse Reichstein Nielsen
2016/11/09 12:31:55
Done.
| |
5099 Otherwise evaluate $e_1$ to an object $u$. | |
5100 If $u$ is the null value, $e$ evalkuates to the null value. | |
5101 Otherwise let $x$ be a fresh variable bound to $u$. | |
5102 Evaluate \code{$x$.$v$-{}-} to an object $o$. | |
5103 Then $e$ evaluates to $o$. | |
5104 | |
5105 | |
5106 \LMHash{} | |
5107 The static type of such an expression is the static type of \code{$e_1$.$v$}. | |
4953 | 5108 |
4954 | 5109 |
4955 \subsection{ Assignable Expressions} | 5110 \subsection{ Assignable Expressions} |
4956 \LMLabel{assignableExpressions} | 5111 \LMLabel{assignableExpressions} |
4957 | 5112 |
4958 \LMHash{} | 5113 \LMHash{} |
4959 Assignable expressions are expressions that can appear on the left hand side of an assignment. | 5114 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. | 5115 This section describes how to evaluate these expressions when they do not consti tute the complete left hand side of an assignment. |
4961 | 5116 |
4962 \rationale{ | 5117 \rationale{ |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5209 | 5364 |
5210 \LMHash{} | 5365 \LMHash{} |
5211 Evaluation of the cast expression \code{$e$ \AS{} $T$} proceeds as follows: | 5366 Evaluation of the cast expression \code{$e$ \AS{} $T$} proceeds as follows: |
5212 | 5367 |
5213 \LMHash{} | 5368 \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$. | 5369 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. | 5370 In all other cases, a \code{CastError} is thrown. |
5216 | 5371 |
5217 \LMHash{} | 5372 \LMHash{} |
5218 The static type of a cast expression \code{$e$ \AS{} $T$} is $T$. | 5373 The static type of a cast expression \code{$e$ \AS{} $T$} is $T$. |
5219 | 5374 |
eernst
2016/11/09 11:35:38
Actually the spec is not at all as consistent as I
Lasse Reichstein Nielsen
2016/11/09 12:31:56
Acknowledged.
| |
5220 | |
5221 \section{Statements} | 5375 \section{Statements} |
5222 \LMLabel{statements} | 5376 \LMLabel{statements} |
5223 | 5377 |
5224 \begin{grammar} | 5378 \begin{grammar} |
5225 {\bf statements:} | 5379 {\bf statements:} |
5226 statement* | 5380 statement* |
5227 . | 5381 . |
5228 | 5382 |
5229 | 5383 |
5230 {\bf statement:} | 5384 {\bf statement:} |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5346 \end{grammar} | 5500 \end{grammar} |
5347 | 5501 |
5348 \LMHash{} | 5502 \LMHash{} |
5349 A function declaration statement of one of the forms $id$ $signature$ $\{ statem ents \}$ or $T$ $id$ $signature$ $\{ statements \}$ causes a new function named $id$ to be added to the innermost enclosing scope. It is a compile-time error to reference a local function before its declaration. | 5503 A function declaration statement of one of the forms $id$ $signature$ $\{ statem ents \}$ or $T$ $id$ $signature$ $\{ statements \}$ causes a new function named $id$ to be added to the innermost enclosing scope. It is a compile-time error to reference a local function before its declaration. |
5350 | 5504 |
5351 | 5505 |
5352 \commentary{ This implies that local functions can be directly recursive, but no t mutually recursive. Consider these examples: | 5506 \commentary{ This implies that local functions can be directly recursive, but no t mutually recursive. Consider these examples: |
5353 } | 5507 } |
5354 | 5508 |
5355 \begin{dartCode} | 5509 \begin{dartCode} |
5356 f(x) =$>$ x++; // a top level function | 5510 f(x) $=$> x++; // a top level function |
eernst
2016/11/09 11:35:37
Revert to `=$>$`, or just omit all `$`s if that wo
Lasse Reichstein Nielsen
2016/11/09 12:31:56
Done.
| |
5357 top() \{ // another top level function | 5511 top() \{ // another top level function |
5358 f(3); // illegal | 5512 f(3); // illegal |
5359 f(x) $=>$ x $>$ 0? x*f(x-1): 1; // recursion is legal | 5513 f(x) $=>$ x $>$ 0? x*f(x-1): 1; // recursion is legal |
5360 g1(x) $=>$ h(x, 1); // error: h is not declared yet | 5514 g1(x) $=>$ h(x, 1); // error: h is not declared yet |
5361 h(x, n) $=>$ x $>$ 1? h(x-1, n*x): n; // again, recursion is fine | 5515 h(x, n) $=>$ x $>$ 1? h(x-1, n*x): n; // again, recursion is fine |
5362 g2(x) $=>$ h(x, 1); // legal | 5516 g2(x) $=>$ h(x, 1); // legal |
5363 | 5517 |
5364 p1(x) $=>$ q(x,x); // illegal | 5518 p1(x) $=>$ q(x,x); // illegal |
5365 q1(a, b)$ =>$ a $>$ 0 ? p1(a-1): b; // fine | 5519 q1(a, b)$ =>$ a $>$ 0 ? p1(a-1): b; // fine |
5366 | 5520 |
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5942 \begin{itemize} | 6096 \begin{itemize} |
5943 \item | 6097 \item |
5944 if there is a dynamically enclosing error handler $g$ defined by a \FINALLY{} c lause in $m$, control is transferred to $g$. | 6098 if there is a dynamically enclosing error handler $g$ defined by a \FINALLY{} c lause in $m$, control is transferred to $g$. |
5945 \item | 6099 \item |
5946 Otherwise $m$ terminates. | 6100 Otherwise $m$ terminates. |
5947 \end{itemize} | 6101 \end{itemize} |
5948 | 6102 |
5949 Otherwise, execution resumes at the end of the try statement. | 6103 Otherwise, execution resumes at the end of the try statement. |
5950 | 6104 |
5951 \LMHash{} | 6105 \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. | 6106 Execution of an \ON{}-\CATCH{} clause \code{\ON{} $T$ \CATCH{} ($p_1$, $p_2$)} $ s$ of a try statement $t$ proceeds as follows: |
6107 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 | 6108 |
5954 \LMHash{} | 6109 \LMHash{} |
5955 Execution of a \FINALLY{} clause \FINALLY{} $s$ of a try statement proceeds as f ollows: | 6110 Execution of a \FINALLY{} clause \FINALLY{} $s$ of a try statement proceeds as f ollows: |
5956 | 6111 |
5957 \LMHash{} | 6112 \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. | 6113 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 | 6114 |
5960 | 6115 |
5961 \LMHash{} | 6116 \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: | 6117 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 | 7854 |
7700 The invariant that each normative paragraph is associated with a line | 7855 The invariant that each normative paragraph is associated with a line |
7701 containing the text \LMHash{} should be maintained. Extra occurrences | 7856 containing the text \LMHash{} should be maintained. Extra occurrences |
7702 of \LMHash{} can be added if needed, e.g., in order to make | 7857 of \LMHash{} can be added if needed, e.g., in order to make |
7703 individual \item{}s in itemized lists addressable. Each \LM.. command | 7858 individual \item{}s in itemized lists addressable. Each \LM.. command |
7704 must occur on a separate line. \LMHash{} must occur immediately | 7859 must occur on a separate line. \LMHash{} must occur immediately |
7705 before the associated paragraph, and \LMLabel must occur immediately | 7860 before the associated paragraph, and \LMLabel must occur immediately |
7706 after the associated \section{}, \subsection{} etc. | 7861 after the associated \section{}, \subsection{} etc. |
7707 | 7862 |
7708 ---------------------------------------------------------------------- | 7863 ---------------------------------------------------------------------- |
OLD | NEW |