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 (Mixin DEP)\\ |
10 {\large Version 1.10}} | 10 {\large Version 1.10}} |
11 | 11 |
12 % For information about Location Markers (and in particular the | 12 % For information about Location Markers (and in particular the |
13 % commands \LMHash and \LMLabel), see the long comment at the | 13 % commands \LMHash and \LMLabel), see the long comment at the |
14 % end of this file. | 14 % end of this file. |
15 | 15 |
16 \begin{document} | 16 \begin{document} |
17 \maketitle | 17 \maketitle |
18 \tableofcontents | 18 \tableofcontents |
19 | 19 |
(...skipping 1985 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2005 % Need warnings if overrider conflicts with overriddee either because signatures are incompatible or because done is a method and one is a getter or setter. | 2005 % Need warnings if overrider conflicts with overriddee either because signatures are incompatible or because done is a method and one is a getter or setter. |
2006 | 2006 |
2007 \section{Mixins} | 2007 \section{Mixins} |
2008 \LMLabel{mixins} | 2008 \LMLabel{mixins} |
2009 | 2009 |
2010 | 2010 |
2011 \LMHash{} | 2011 \LMHash{} |
2012 A mixin describes the difference between a class and its superclass. A mixin is always derived from an existing class declaration. | 2012 A mixin describes the difference between a class and its superclass. A mixin is always derived from an existing class declaration. |
2013 | 2013 |
2014 \LMHash{} | 2014 \LMHash{} |
2015 It is a compile-time error if a declared or derived mixin refers to \SUPER{}. It is a compile-time error if a declared or derived mixin explicitly declares a co nstructor. It is a compile-time error if a mixin is derived from a class whose s uperclass is not \code{Object}. | 2015 It is a compile-time error if a declared or derived mixin explicitly declares a constructor. |
2016 | 2016 |
2017 \rationale{ | 2017 \rationale{ |
2018 These restrictions are temporary. We expect to remove them in later versions of Dart. | 2018 These restrictions are temporary. We expect to remove them in later versions of Dart. |
2019 | 2019 |
2020 The restriction on the use of \SUPER{} avoids the problem of rebinding \SUPER{} when the mixin is bound to difference superclasses. | |
2021 | |
2022 The restriction on constructors simplifies the construction of mixin application s because the process of creating instances is simpler. | 2020 The restriction on constructors simplifies the construction of mixin application s because the process of creating instances is simpler. |
2023 | |
2024 The restriction on the superclass means that the type of a class from which a m ixin is derived is always implemented by any class that mixes it in. This allows us to defer the question of whether and how to express the type of the mixin in dependently of its superclass and super interface types. | |
2025 | |
2026 Reasonable answers exist for all these issues, but their implementation is non-t rivial. | |
2027 } | 2021 } |
2028 | 2022 |
2029 \subsection{Mixin Application} | 2023 \subsection{Mixin Application} |
2030 \LMLabel{mixinApplication} | 2024 \LMLabel{mixinApplication} |
2031 | 2025 |
2032 \LMHash{} | 2026 \LMHash{} |
2033 A mixin may be applied to a superclass, yielding a new class. Mixin application occurs when a mixin is mixed into a class declaration via its \WITH{} clause. T he mixin application may be used to extend a class per section (\ref{classes}); alternately, a class may be defined as a mixin application as described in this section. It is a compile-time error if the \WITH{} clause of a mixin applicati on $C$ includes a deferred type expression. | 2027 A mixin may be applied to a superclass, yielding a new class. Mixin application occurs when a mixin is mixed into a class declaration via its \WITH{} clause. T he mixin application may be used to extend a class per section (\ref{classes}); alternately, a class may be defined as a mixin application as described in this section. It is a compile-time error if the \WITH{} clause of a mixin applicati on $C$ includes a deferred type expression. |
2034 | 2028 |
2035 | 2029 |
2036 \begin{grammar} | 2030 \begin{grammar} |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2070 | 2064 |
2071 \commentary{ | 2065 \commentary{ |
2072 If, for example, $M$ declares an instance member $im$ whose type is at odds with the type of a member of the same name in $S$, this will result in a static warn ing just as if we had defined $K$ by means of an ordinary class declaration exte nding $S$, with a body that included $im$. | 2066 If, for example, $M$ declares an instance member $im$ whose type is at odds with the type of a member of the same name in $S$, this will result in a static warn ing just as if we had defined $K$ by means of an ordinary class declaration exte nding $S$, with a body that included $im$. |
2073 | 2067 |
2074 } | 2068 } |
2075 | 2069 |
2076 \LMHash{} | 2070 \LMHash{} |
2077 The effect of a class definition of the form \code{\CLASS{} $C$ = $M$; } or the form | 2071 The effect of a class definition of the form \code{\CLASS{} $C$ = $M$; } or the form |
2078 \code{\CLASS{} $C<T_1, \ldots, T_n>$ = $M$; } in library $L$ is to introduce t he name $C$ into the scope of $L$, bound to the class (\ref{classes}) defined by the mixin application $M$. The name of the class is also set to $C$. Iff the c lass is prefixed by the built-in identifier \ABSTRACT{}, the class being defined is an abstract class. | 2072 \code{\CLASS{} $C<T_1, \ldots, T_n>$ = $M$; } in library $L$ is to introduce t he name $C$ into the scope of $L$, bound to the class (\ref{classes}) defined by the mixin application $M$. The name of the class is also set to $C$. Iff the c lass is prefixed by the built-in identifier \ABSTRACT{}, the class being defined is an abstract class. |
2079 | 2073 |
2074 Let $M_A$ be a mixin derived from a class $M$ with direct superclass $S$. | |
2075 | |
2076 Let $A$ be an application of $M_A$. It is a static warning if the superclass of $A$ is not a subtype of $S$. | |
eernst
2015/06/23 15:45:03
Maybe these two occurrences of $S$ should be chang
gbracha
2015/06/23 19:53:47
It doesn't matter much as there is no question of
| |
2077 | |
2078 Let $C$ be a class declaration that includes $M_A$ in a with clause. It is a sta tic warning if $C$ does not implement, directly or indirectly, all the direct su perinterfaces of $M$. | |
Lasse Reichstein Nielsen
2015/06/23 08:06:23
Does this need a `@proxy` exception too? That is,
gbracha
2015/06/23 19:53:47
Short answer: No.
Long answer:
For whatever dark
| |
2079 | |
2080 | 2080 |
2081 \subsection{Mixin Composition} | 2081 \subsection{Mixin Composition} |
2082 \LMLabel{mixinComposition} | 2082 \LMLabel{mixinComposition} |
2083 | 2083 |
2084 \rationale{ | 2084 \rationale{ |
2085 Dart does not directly support mixin composition, but the concept is useful when defining how the superclass of a class with a mixin clause is created. | 2085 Dart does not directly support mixin composition, but the concept is useful when defining how the superclass of a class with a mixin clause is created. |
2086 } | 2086 } |
2087 | 2087 |
2088 \LMHash{} | 2088 \LMHash{} |
2089 The {\em composition of two mixins}, $M_1<T_1 \ldots T_{k_{M_1}}>$ and $M_2<U_1 \ldots U_{k_{M_2}}>$, written $M_1<T_1 \ldots T_{k_{M_1}}> * M_2<U_1 \ldots U_ {k_{M_2}}>$ defines an anonymous mixin such that for any class $S<V_1 \ldots V_{ k_S}>$, the application of | 2089 The {\em composition of two mixins}, $M_1<T_1 \ldots T_{k_{M_1}}>$ and $M_2<U_1 \ldots U_{k_{M_2}}>$, written $M_1<T_1 \ldots T_{k_{M_1}}> * M_2<U_1 \ldots U_ {k_{M_2}}>$ defines an anonymous mixin such that for any class $S<V_1 \ldots V_{ k_S}>$, the application of |
(...skipping 1636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3726 \LMLabel{lookup} | 3726 \LMLabel{lookup} |
3727 | 3727 |
3728 \subsubsection{Method Lookup} | 3728 \subsubsection{Method Lookup} |
3729 \LMLabel{methodLookup} | 3729 \LMLabel{methodLookup} |
3730 | 3730 |
3731 \LMHash{} | 3731 \LMHash{} |
3732 The result of a lookup of a method $m$ in object $o$ with respect to library $L$ is the result of a lookup of method $m$ in class $C$ with respect to library $ L$, where $C$ is the class of $o$. | 3732 The result of a lookup of a method $m$ in object $o$ with respect to library $L$ is the result of a lookup of method $m$ in class $C$ with respect to library $ L$, where $C$ is the class of $o$. |
3733 | 3733 |
3734 \LMHash{} | 3734 \LMHash{} |
3735 The result of a lookup of method $m$ in class $C$ with respect to library $L$ i s: | 3735 The result of a lookup of method $m$ in class $C$ with respect to library $L$ i s: |
3736 If $C$ declares a concrete instance method named $m$ that is accessible to $L$, then that method is the result of the lookup. Otherwise, if $C$ has a superclas s $S$, then the result of the lookup is the result of looking up $m$ in $S$ wit h respect to $L$. Otherwise, we say that the method lookup has failed. | 3736 If $C$ declares a concrete instance method named $m$ that is accessible to $L$, then that method is the result of the lookup, and we say that the method was {\ em looked up in $C$}. Otherwise, if $C$ has a superclass $S$, then the result of the lookup is the result of looking up $m$ in $S$ with respect to $L$. Otherwi se, we say that the method lookup has failed. |
eernst
2015/06/23 15:45:03
Would it be better to find all occurrences of 'sup
gbracha
2015/06/23 19:53:48
Lasse made a similar comment for one specific case
| |
3737 | 3737 |
3738 \rationale { | 3738 \rationale { |
3739 The motivation for skipping abstract members during lookup is largely to allow s moother mixin composition. | 3739 The motivation for skipping abstract members during lookup is largely to allow s moother mixin composition. |
3740 } | 3740 } |
3741 | 3741 |
3742 | 3742 |
3743 \subsubsection{ Getter and Setter Lookup} | 3743 \subsubsection{ Getter and Setter Lookup} |
3744 \LMLabel{getterAndSetterLookup} | 3744 \LMLabel{getterAndSetterLookup} |
3745 | 3745 |
3746 \LMHash{} | 3746 \LMHash{} |
3747 The result of a lookup of a getter (respectively setter) $m$ in object $o$ with respect to library $L$ is the result of looking up getter (respectively sette r) $m$ in class $C$ with respect to $L$, where $C$ is the class of $o$. | 3747 The result of a lookup of a getter (respectively setter) $m$ in object $o$ with respect to library $L$ is the result of looking up getter (respectively sette r) $m$ in class $C$ with respect to $L$, where $C$ is the class of $o$. |
3748 | 3748 |
3749 \LMHash{} | 3749 \LMHash{} |
3750 The result of a lookup of a getter (respectively setter) $m$ in class $C$ with respect to library $L$ is: | 3750 The result of a lookup of a getter (respectively setter) $m$ in class $C$ with respect to library $L$ is: |
3751 If $C$ declares a concrete instance getter (respectively setter) named $m$ that is accessible to $L$, then that getter (respectively setter) is the result of the lookup. Otherwise, if $C$ has a superclass $S$, then the result of the looku p is the result of looking up getter (respectively setter) $m$ in $S$ with respe ct to $L$. Otherwise, we say that the lookup has failed. | 3751 If $C$ declares a concrete instance getter (respectively setter) named $m$ that is accessible to $L$, then that getter (respectively setter) is the result of the lookup, and we say that the getter (respectively setter) was {\em looked up in $C$}. Otherwise, if $C$ has a superclass $S$, then the result of the lookup i s the result of looking up getter (respectively setter) $m$ in $S$ with respect to $L$. Otherwise, we say that the lookup has failed. |
3752 | 3752 |
3753 \rationale { | 3753 \rationale { |
3754 The motivation for skipping abstract members during lookup is largely to allow s moother mixin composition. | 3754 The motivation for skipping abstract members during lookup is largely to allow s moother mixin composition. |
3755 } | 3755 } |
3756 | 3756 |
3757 | 3757 |
3758 \subsection{ Top level Getter Invocation} | 3758 \subsection{ Top level Getter Invocation} |
3759 \LMLabel{topLevelGetterInvocation} | 3759 \LMLabel{topLevelGetterInvocation} |
3760 | 3760 |
3761 \LMHash{} | 3761 \LMHash{} |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3912 | 3912 |
3913 \LMHash{} | 3913 \LMHash{} |
3914 A super method invocation $i$ has the form | 3914 A super method invocation $i$ has the form |
3915 | 3915 |
3916 $\SUPER{}.m(a_1, \ldots , a_n, x_{n+1}: a_{n+1}, \ldots , x_{n+k}: a_{n+k})$. | 3916 $\SUPER{}.m(a_1, \ldots , a_n, x_{n+1}: a_{n+1}, \ldots , x_{n+k}: a_{n+k})$. |
3917 | 3917 |
3918 \LMHash{} | 3918 \LMHash{} |
3919 Evaluation of $i$ proceeds as follows: | 3919 Evaluation of $i$ proceeds as follows: |
3920 | 3920 |
3921 \LMHash{} | 3921 \LMHash{} |
3922 First, 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 $S$ be the superclass of the immediately enclosing class, and let $f$ be the result of looking up method (\ref{methodLookup}) $m$ in $S$ with respect to the current library $L$. | 3922 First, 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 $g$ be the method currently executing, and let $C$ be the class in which $g$ was looked up (\ref{methodLookup}). Let $S_{dynamic}$ be the superclass of $C$, and let $f$ be the result of looking up method (\ref{methodLookup}) $m$ in $S_{dynamic}$ with respect to the current library $L$. |
Lasse Reichstein Nielsen
2015/06/19 09:36:27
This requires the lookup-class of a method to be r
eernst
2015/06/23 15:45:03
$S_{dynamic}$ seems to imply that the given class
eernst
2015/06/23 15:45:03
Actually, the method would be 'looked up in' the c
gbracha
2015/06/23 19:53:48
It's easy if the implementation copies down method
gbracha
2015/06/23 19:53:48
It's constant until you have dynamic mixin applica
Lasse Reichstein Nielsen
2015/06/24 12:16:10
The result of doing super.foo in the X.superFoo ge
| |
3923 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$. | 3923 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$. |
Lasse Reichstein Nielsen
2015/06/19 09:36:27
This seems to assume that $f$ is found.
How about:
gbracha
2015/06/23 19:53:48
Yes, this assumes that other lookup failures are h
| |
3924 | 3924 |
3925 \LMHash{} | 3925 \LMHash{} |
3926 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. Otherwise method looku p has succeeded. | 3926 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. Otherwise method looku p has succeeded. |
3927 | 3927 |
3928 \LMHash{} | 3928 \LMHash{} |
3929 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 the current value of \THIS{}. The value of $i$ is the value returned after $f$ is executed. | 3929 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 the current value of \THIS{}. The value of $i$ is the value returned after $f$ is executed. |
3930 | 3930 |
3931 \LMHash{} | 3931 \LMHash{} |
3932 If the method lookup has failed, then let $g$ be the result of looking up getter (\ref{getterAndSetterLookup}) $m$ in $S$ with respect to $L$. If the getter loo kup succeeded, let $v_g$ be the value of the getter invocation $\SUPER{}.m$. The n the value of $i$ is the result of invoking | 3932 If the method lookup has failed, then let $g$ be the result of looking up getter (\ref{getterAndSetterLookup}) $m$ in $S_{dynamic}$ with respect to $L$. If the getter lookup succeeded, let $v_g$ be the value of the getter invocation $\SUPER {}.m$. Then the value of $i$ is the result of invoking |
3933 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}\}$. | 3933 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}\}$. |
3934 | 3934 |
3935 \LMHash{} | 3935 \LMHash{} |
3936 If getter lookup has also failed, then a new instance $im$ of the predefined c lass \code{Invocation} is created, such that : | 3936 If getter lookup has also failed, then a new instance $im$ of the predefined c lass \code{Invocation} is created, such that : |
3937 \begin{itemize} | 3937 \begin{itemize} |
3938 \item \code{im.isMethod} evaluates to \code{\TRUE{}}. | 3938 \item \code{im.isMethod} evaluates to \code{\TRUE{}}. |
3939 \item \code{im.memberName} evaluates to the symbol \code{m}. | 3939 \item \code{im.memberName} evaluates to the symbol \code{m}. |
3940 \item \code{im.positionalArguments} evaluates to an immutable list with the same values as \code{[$o_1, \ldots, o_n$]}. | 3940 \item \code{im.positionalArguments} evaluates to an immutable list with the same values as \code{[$o_1, \ldots, o_n$]}. |
3941 \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}$\}}. | 3941 \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}$\}}. |
3942 \end{itemize} | 3942 \end{itemize} |
3943 Then the method \code{noSuchMethod()} is looked up in $S$ and invoked on \THIS{} with argument $im$, and the result of this invocation is the result of evaluati ng $i$. However, if the implementation found cannot be invoked with a single pos itional argument, the implementation of \code{noSuchMethod()} in class \code{Ob ject} is invoked on \THIS{} with argument $im'$, where $im'$ is an instance of \ code{Invocation} such that : | 3943 Then the method \code{noSuchMethod()} is looked up in $S_{dynamic}$ and invoked on \THIS{} with argument $im$, and the result of this invocation is the result o f evaluating $i$. However, if the implementation found cannot be invoked with a single positional argument, the implementation of \code{noSuchMethod()} in clas s \code{Object} is invoked on \THIS{} with argument $im'$, where $im'$ is an ins tance of \code{Invocation} such that : |
3944 \begin{itemize} | 3944 \begin{itemize} |
3945 \item \code{im'.isMethod} evaluates to \code{\TRUE{}}. | 3945 \item \code{im'.isMethod} evaluates to \code{\TRUE{}}. |
3946 \item \code{im'.memberName} evaluates to \code{\#noSuchMethod}. | 3946 \item \code{im'.memberName} evaluates to \code{\#noSuchMethod}. |
3947 \item \code{im'.positionalArguments} evaluates to an immutable list whose sole e lement is $im$. | 3947 \item \code{im'.positionalArguments} evaluates to an immutable list whose sole e lement is $im$. |
3948 \item \code{im'.namedArguments} evaluates to the value of \code{\CONST{} \{\}}. | 3948 \item \code{im'.namedArguments} evaluates to the value of \code{\CONST{} \{\}}. |
3949 \end{itemize} | 3949 \end{itemize} |
3950 | 3950 |
3951 and the result of this latter invocation is the result of evaluating $i$. | 3951 and the result of this latter invocation is the result of evaluating $i$. |
3952 | 3952 |
3953 | 3953 |
3954 \LMHash{} | 3954 \LMHash{} |
3955 It is a compile-time error if a super method invocation occurs in a top-level fu nction or variable initializer, in an instance variable initializer or initializ er list, in class \code{Object}, in a factory constructor or in a static method or variable initializer. | 3955 It is a compile-time error if a super method invocation occurs in a top-level fu nction or variable initializer, in an instance variable initializer or initializ er list, in class \code{Object}, in a factory constructor or in a static method or variable initializer. |
3956 | 3956 |
3957 \LMHash{} | 3957 \LMHash{} |
3958 It is a static type warning if $S$ does not have an accessible (\ref{privacy}) i nstance member named $m$ unless $S$ or a superinterface of $S$ is annotated with an annotation denoting a constant identical to the constant \code{@proxy} defin ed in \code{dart:core}. If $S.m$ exists, it is a static type warning if the typ e $F$ of $S.m$ may not be assigned to a function type. If $S.m$ does not exist, or if $F$ is not a function type, the static type of $i$ is \DYNAMIC{}; otherwis e the static type of $i$ is the declared return type of $F$. | 3958 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 (\ref{privacy}) i nstance member named $m$ unless $S_{static}$ or a superinterface of $S_{static}$ is annotated with an annotation denoting a constant identical to the constant \ code{@proxy} defined in \code{dart:core}. If $S_{static}.m$ exists, it is a sta tic type warning if the type $F$ of $S_{static}.m$ may not be assigned to a func tion type. If $S_{static}.m$ does not exist, or if $F$ is not a function type, t he static type of $i$ is \DYNAMIC{}; otherwise the static type of $i$ is the dec lared return type of $F$. |
eernst
2015/06/23 15:45:03
Looking at this again, it does make a lot of sense
gbracha
2015/06/23 19:53:47
Not sure if you're agreeing with me or not. I'll a
| |
3959 % The following is not needed because it is specified in 'Binding Actuals to For mals" | 3959 % The following is not needed because it is specified in 'Binding Actuals to For mals" |
3960 %Let $T_i$ be the static type of $a_i, i \in 1 .. n+k$. It is a static warning i f $F$ is not a supertype of $(T_1, \ldots, t_n, \{T_{n+1}$ $x_{n+1}, \ldots, T_ {n+k}$ $x_{n+k}\}) \to \bot$. | 3960 %Let $T_i$ be the static type of $a_i, i \in 1 .. n+k$. It is a static warning i f $F$ is not a supertype of $(T_1, \ldots, t_n, \{T_{n+1}$ $x_{n+1}, \ldots, T_ {n+k}$ $x_{n+k}\}) \to \bot$. |
3961 | 3961 |
3962 | 3962 |
3963 | 3963 |
3964 | 3964 |
3965 \subsubsection{Sending Messages} | 3965 \subsubsection{Sending Messages} |
3966 \LMLabel{sendingMessages} | 3966 \LMLabel{sendingMessages} |
3967 | 3967 |
3968 \LMHash{} | 3968 \LMHash{} |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4063 \end{itemize} | 4063 \end{itemize} |
4064 | 4064 |
4065 | 4065 |
4066 \subsubsection{Super Getter Access and Method Closurization} | 4066 \subsubsection{Super Getter Access and Method Closurization} |
4067 \LMLabel{superGetterAccessAndMethodClosurization} | 4067 \LMLabel{superGetterAccessAndMethodClosurization} |
4068 | 4068 |
4069 \LMHash{} | 4069 \LMHash{} |
4070 Evaluation of a property extraction $i$ of the form $\SUPER.m$ proceeds as follo ws: | 4070 Evaluation of a property extraction $i$ of the form $\SUPER.m$ proceeds as follo ws: |
4071 | 4071 |
4072 \LMHash{} | 4072 \LMHash{} |
4073 Let $S$ be the superclass of the immediately enclosing class. Let $f$ be the re sult of looking up method $m$ in $S$ with respect to the current library $L$. I f method lookup succeeds then $i$ evaluates to the closurization of method $f$ w ith respect to superclass $S$ (\ref{superClosurization}). | 4073 Let $g$ be the method currently executing, and let $C$ be the class in which $g$ was looked up. Let $S_{dynamic}$ be the superclass of $C$. Let $f$ be the resu lt of looking up method $m$ in $S_{dynamic}$ with respect to the current library $L$. If method lookup succeeds then $i$ evaluates to the closurization of meth od $f$ with respect to superclass $S_{dynamic}$ (\ref{superClosurization}). |
4074 | 4074 |
4075 \LMHash{} | 4075 \LMHash{} |
4076 Otherwise, $i$ is a getter invocation. Let $f$ be the result of looking up ge tter $m$ in $S$ with respect to $L$. The body of $f$ is executed with \THIS{} bound to the current value of \THIS{}. The value of $i$ is the result returne d by the call to the getter function. | 4076 Otherwise, $i$ is a getter invocation. Let $f$ be the result of looking up ge tter $m$ in $S_{dynamic}$ with respect to $L$. The body of $f$ is executed wi th \THIS{} bound to the current value of \THIS{}. The value of $i$ is the resu lt returned by the call to the getter function. |
4077 | 4077 |
4078 \LMHash{} | 4078 \LMHash{} |
4079 If the getter lookup has failed, then a new instance $im$ of the predefined cla ss \code{Invocation} is created, such that : | 4079 If the getter lookup has failed, then a new instance $im$ of the predefined cla ss \code{Invocation} is created, such that : |
4080 \begin{itemize} | 4080 \begin{itemize} |
4081 \item \code{im.isGetter} evaluates to \code{\TRUE{}}. | 4081 \item \code{im.isGetter} evaluates to \code{\TRUE{}}. |
4082 \item \code{im.memberName} evaluates to the symbol \code{m}. | 4082 \item \code{im.memberName} evaluates to the symbol \code{m}. |
4083 \item \code{im.positionalArguments} evaluates to the value of \code{\CONST{} []} . | 4083 \item \code{im.positionalArguments} evaluates to the value of \code{\CONST{} []} . |
4084 \item \code{im.namedArguments} evaluates to the value of \code{\CONST{} \{\}}. | 4084 \item \code{im.namedArguments} evaluates to the value of \code{\CONST{} \{\}}. |
4085 \end{itemize} | 4085 \end{itemize} |
4086 Then the method \code{noSuchMethod()} is looked up in $S$ and invoked with argu ment $im$, and the result of this invocation is the result of evaluating $i$. Ho wever, if the implementation found cannot be invoked with a single positional ar gument, the implementation of \code{noSuchMethod()} in class \code{Object} is i nvoked on \THIS{} with argument $im'$, where $im'$ is an instance of \code{Invoc ation} such that : | 4086 Then the method \code{noSuchMethod()} is looked up in $S_{dynamic}$ and invoked with argument $im$, and the result of this invocation is the result of evaluati ng $i$. However, if the implementation found cannot be invoked with a single pos itional argument, the implementation of \code{noSuchMethod()} in class \code{Ob ject} is invoked on \THIS{} with argument $im'$, where $im'$ is an instance of \ code{Invocation} such that : |
4087 \begin{itemize} | 4087 \begin{itemize} |
4088 \item \code{im'.isMethod} evaluates to \code{\TRUE{}}. | 4088 \item \code{im'.isMethod} evaluates to \code{\TRUE{}}. |
4089 \item \code{im'.memberName} evaluates to \code{\#noSuchMethod}. | 4089 \item \code{im'.memberName} evaluates to \code{\#noSuchMethod}. |
4090 \item \code{im'.positionalArguments} evaluates to an immutable list whose sole e lement is $im$. | 4090 \item \code{im'.positionalArguments} evaluates to an immutable list whose sole e lement is $im$. |
4091 \item \code{im'.namedArguments} evaluates to the value of \code{\CONST{} \{\}}. | 4091 \item \code{im'.namedArguments} evaluates to the value of \code{\CONST{} \{\}}. |
4092 \end{itemize} | 4092 \end{itemize} |
4093 and the result of this latter invocation is the result of evaluating $i$. | 4093 and the result of this latter invocation is the result of evaluating $i$. |
4094 | 4094 |
4095 \LMHash{} | 4095 \LMHash{} |
4096 It is a static type warning if $S$ does not have an accessible instance method o r getter named $m$. | 4096 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 method o r getter named $m$. |
Lasse Reichstein Nielsen
2015/06/19 09:36:27
Will this method be concrete, or can an abstract m
gbracha
2015/06/23 19:53:47
(1) This has nothing to do with this CL; it has to
| |
4097 | 4097 |
4098 The static type of $i$ is: | 4098 The static type of $i$ is: |
4099 \begin{itemize} | 4099 \begin{itemize} |
4100 \item The declared return type of $S.m$, if $S$ has an accessible instance gette r named $m$. | 4100 \item The declared return type of $S_{static}.m$, if $S_{static}$ has an accessi ble instance getter named $m$. |
4101 \item The static type of function $S.m$ if $S$ has an accessible instance method named $m$. | 4101 \item The static type of function $S_{static}.m$ if $S_{static}$ has an accessib le instance method named $m$. |
4102 \item The type \DYNAMIC{} otherwise. | 4102 \item The type \DYNAMIC{} otherwise. |
4103 \end{itemize} | 4103 \end{itemize} |
4104 | 4104 |
4105 | 4105 |
4106 \subsubsection{General Closurization} | 4106 \subsubsection{General Closurization} |
4107 \LMLabel{generalClosurization} | 4107 \LMLabel{generalClosurization} |
4108 | 4108 |
4109 \LMHash{} | 4109 \LMHash{} |
4110 Evaluation of a property extraction $i$ of the form $e\#m$ proceeds as follows: | 4110 Evaluation of a property extraction $i$ of the form $e\#m$ proceeds as follows: |
4111 | 4111 |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4200 The static type of $i$ is the type of the constructor function $T()$, if $T$ den otes a class in the surrounding scope with an anonymous constructor $T()$. Other wise the static type of $i$ is \DYNAMIC{}. | 4200 The static type of $i$ is the type of the constructor function $T()$, if $T$ den otes a class in the surrounding scope with an anonymous constructor $T()$. Other wise the static type of $i$ is \DYNAMIC{}. |
4201 | 4201 |
4202 \subsubsection{General Super Property Extraction} | 4202 \subsubsection{General Super Property Extraction} |
4203 \LMLabel{generalSuperPropertyExtraction} | 4203 \LMLabel{generalSuperPropertyExtraction} |
4204 | 4204 |
4205 | 4205 |
4206 \LMHash{} | 4206 \LMHash{} |
4207 Evaluation of a property extraction $i$ of the form \SUPER$\#m$ proceeds as foll ows: | 4207 Evaluation of a property extraction $i$ of the form \SUPER$\#m$ proceeds as foll ows: |
4208 | 4208 |
4209 \LMHash{} | 4209 \LMHash{} |
4210 Let $S$ be the superclass of the immediately enclosing class. | 4210 Let $g$ be the method currently executing, and let $C$ be the class in which $g$ was looked up. Let $S_{dynamic}$ be the superclass of $C$. Let $S_{dynamic}$ b e the superclass of the $C$. |
eernst
2015/06/23 15:45:03
Last sentence duplicated.
gbracha
2015/06/23 19:53:47
It's idempotent :-). Fixed.
| |
4211 | 4211 |
4212 \LMHash{} | 4212 \LMHash{} |
4213 If $m$ is a setter name, let $f$ be the result of looking up setter $m$ in $S$ w ith respect to the current library $L$. If setter lookup succeeds then $i$ evalu ates to the closurization of setter $f$ with respect to superclass $S$ (\ref{s uperClosurization}). If setter lookup failed, a \cd{NoSuchMethodError} is throw n. | 4213 If $m$ is a setter name, let $f$ be the result of looking up setter $m$ in $S_{d ynamic}$ with respect to the current library $L$. If setter lookup succeeds then $i$ evaluates to the closurization of setter $f$ with respect to superclass $S _{dynamic}$ (\ref{superClosurization}). If setter lookup failed, a \cd{NoSuchM ethodError} is thrown. |
4214 | 4214 |
4215 If $m$ is not a setter name, let $f$ be the result of looking up method $m$ in $ S$ with respect to the current library $L$. If method lookup succeeds then $i$ e valuates to the closurization of method $m$ with respect to superclass $S$ (\ref {superClosurization}). | 4215 If $m$ is not a setter name, let $f$ be the result of looking up method $m$ in $ S_{dynamic}$ with respect to the current library $L$. If method lookup succeeds then $i$ evaluates to the closurization of method $m$ with respect to superclass $S_{dynamic}$ (\ref{superClosurization}). |
4216 | 4216 |
4217 \LMHash{} | 4217 \LMHash{} |
4218 Otherwise, let $f$ be the result of looking up getter $m$ in $S$ with respect t o the current library $L$. If getter lookup succeeds then $i$ evaluates to the closurization of getter $f$ with respect to superclass $S$ (\ref{superClosurizat ion}). If getter lookup failed, a \cd{NoSuchMethodError} is thrown. | 4218 Otherwise, let $f$ be the result of looking up getter $m$ in $S_{dynamic}$ with respect to the current library $L$. If getter lookup succeeds then $i$ evaluat es to the closurization of getter $f$ with respect to superclass $S_{dynamic}$ ( \ref{superClosurization}). If getter lookup failed, a \cd{NoSuchMethodError} i s thrown. |
4219 | 4219 |
4220 \LMHash{} | 4220 \LMHash{} |
4221 It is a static type warning if $S$ does not have an accessible instance member n amed $m$. | 4221 Let $S_{static}$ be the superclass of the immediately enclosing class.It is a st atic type warning if $S_{static}$ does not have an accessible instance member na med $m$. |
4222 | 4222 |
4223 \LMHash{} | 4223 \LMHash{} |
4224 The static type of $i$ is the static type of the function $S.m$, if $S$ has an accessible instance member named $m$. Otherwise the static type of $i$ is \DYNAM IC{}. | 4224 The static type of $i$ is the static type of the function $S_{static}.m$, if $S _{static}$ has an accessible instance member named $m$. Otherwise the static typ e of $i$ is \DYNAMIC{}. |
4225 | 4225 |
4226 | 4226 |
4227 | 4227 |
4228 \subsubsection{Ordinary Member Closurization} | 4228 \subsubsection{Ordinary Member Closurization} |
4229 \LMLabel{ordinaryMemberClosurization} | 4229 \LMLabel{ordinaryMemberClosurization} |
4230 | 4230 |
4231 | 4231 |
4232 \LMHash{} | 4232 \LMHash{} |
4233 Let $o$ be an object, and let $u$ be a fresh final variable bound to $o$. | 4233 Let $o$ be an object, and let $u$ be a fresh final variable bound to $o$. |
4234 The {\em closurization of method $f$ on object $o$} is defined to be equivalent to: | 4234 The {\em closurization of method $f$ on object $o$} is defined to be equivalent to: |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4476 | 4476 |
4477 | 4477 |
4478 | 4478 |
4479 \LMHash{} | 4479 \LMHash{} |
4480 It is a static type warning if the static type of $e_2$ may not be assigned to t he static type of the formal parameter of the setter $v=$. The static type of the expression $e_1.v$ \code{=} $e_2$ is the static type of $e_2$. | 4480 It is a static type warning if the static type of $e_2$ may not be assigned to t he static type of the formal parameter of the setter $v=$. The static type of the expression $e_1.v$ \code{=} $e_2$ is the static type of $e_2$. |
4481 | 4481 |
4482 \LMHash{} | 4482 \LMHash{} |
4483 Evaluation of an assignment of the form $\SUPER.v$ \code{=} $e$ proceeds as foll ows: | 4483 Evaluation of an assignment of the form $\SUPER.v$ \code{=} $e$ proceeds as foll ows: |
4484 | 4484 |
4485 \LMHash{} | 4485 \LMHash{} |
4486 Let $S$ be the superclass of the immediately enclosing class. | 4486 Let $g$ be the method currently executing, and let $C$ be the class in which $g$ was looked up. Let $S_{dynamic}$ be the superclass of $C$. |
4487 The expression $e$ is evaluated to an object $o$. Then, the setter $v=$ is look ed up (\ref{getterAndSetterLookup}) in $S$ with respect to the current library. The body of $v=$ is executed with its formal parameter bound to $o$ and \THIS{ } bound to \THIS{}. | 4487 The expression $e$ is evaluated to an object $o$. Then, the setter $v=$ is look ed up (\ref{getterAndSetterLookup}) in $S_{dynamic}$ with respect to the current library. The body of $v=$ is executed with its formal parameter bound to $o$ and \THIS{} bound to \THIS{}. |
4488 | 4488 |
4489 \LMHash{} | 4489 \LMHash{} |
4490 If the setter lookup has failed, then a new instance $im$ of the predefined cla ss \code{Invocation} is created, such that : | 4490 If the setter lookup has failed, then a new instance $im$ of the predefined cla ss \code{Invocation} is created, such that : |
4491 \begin{itemize} | 4491 \begin{itemize} |
4492 \item \code{im.isSetter} evaluates to \code{\TRUE{}}. | 4492 \item \code{im.isSetter} evaluates to \code{\TRUE{}}. |
4493 \item \code{im.memberName} evaluates to the symbol \code{v=}. | 4493 \item \code{im.memberName} evaluates to the symbol \code{v=}. |
4494 \item \code{im.positionalArguments} evaluates to an immutable list with the same values as \code{[$o$]}. | 4494 \item \code{im.positionalArguments} evaluates to an immutable list with the same values as \code{[$o$]}. |
4495 \item \code{im.namedArguments} evaluates to the value of \code{\CONST{} \{\}}. | 4495 \item \code{im.namedArguments} evaluates to the value of \code{\CONST{} \{\}}. |
4496 \end{itemize} | 4496 \end{itemize} |
4497 | 4497 |
4498 \LMHash{} | 4498 \LMHash{} |
4499 Then the method \code{noSuchMethod()} is looked up in $S$ and invoked with argu ment $im$. | 4499 Then the method \code{noSuchMethod()} is looked up in $S_{dynamic}$ and invoked with argument $im$. |
4500 However, if the implementation found cannot be invoked with a single positional argument, the implementation of \code{noSuchMethod()} in class \code{Object} is invoked on \THIS{} with argument $im'$, where $im'$ is an instance of \code{Inv ocation} such that : | 4500 However, if the implementation found cannot be invoked with a single positional argument, the implementation of \code{noSuchMethod()} in class \code{Object} is invoked on \THIS{} with argument $im'$, where $im'$ is an instance of \code{Inv ocation} such that : |
4501 \begin{itemize} | 4501 \begin{itemize} |
4502 \item \code{im'.isMethod} evaluates to \code{\TRUE{}}. | 4502 \item \code{im'.isMethod} evaluates to \code{\TRUE{}}. |
4503 \item \code{im'.memberName} evaluates to \code{\#noSuchMethod}. | 4503 \item \code{im'.memberName} evaluates to \code{\#noSuchMethod}. |
4504 \item \code{im'.positionalArguments} evaluates to an immutable list whose sole e lement is $im$. | 4504 \item \code{im'.positionalArguments} evaluates to an immutable list whose sole e lement is $im$. |
4505 \item \code{im'.namedArguments} evaluates to the value of \code{\CONST{} \{\}}. | 4505 \item \code{im'.namedArguments} evaluates to the value of \code{\CONST{} \{\}}. |
4506 \end{itemize} | 4506 \end{itemize} |
4507 | 4507 |
4508 \LMHash{} | 4508 \LMHash{} |
4509 The value of the assignment expression is $o$ irrespective of whether setter loo kup has failed or succeeded. | 4509 The value of the assignment expression is $o$ irrespective of whether setter loo kup has failed or succeeded. |
4510 | 4510 |
4511 \LMHash{} | 4511 \LMHash{} |
4512 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$. | 4512 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$. |
4513 | 4513 |
4514 \LMHash{} | 4514 \LMHash{} |
4515 It is a static type warning if $S$ does not have an accessible instance setter n amed $v=$ unless $S$ or a superinterface of $S$ is annotated with an annotation denoting a constant identical to the constant \code{@proxy} defined in \code{dar t:core}. | 4515 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}. |
4516 | 4516 |
4517 \LMHash{} | 4517 \LMHash{} |
4518 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$. | 4518 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$. |
4519 | 4519 |
4520 | 4520 |
4521 | 4521 |
4522 | 4522 |
4523 | 4523 |
4524 | 4524 |
4525 \LMHash{} | 4525 \LMHash{} |
(...skipping 3310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7836 | 7836 |
7837 The invariant that each normative paragraph is associated with a line | 7837 The invariant that each normative paragraph is associated with a line |
7838 containing the text \LMHash{} should be maintained. Extra occurrences | 7838 containing the text \LMHash{} should be maintained. Extra occurrences |
7839 of \LMHash{} can be added if needed, e.g., in order to make | 7839 of \LMHash{} can be added if needed, e.g., in order to make |
7840 individual \item{}s in itemized lists addressable. Each \LM.. command | 7840 individual \item{}s in itemized lists addressable. Each \LM.. command |
7841 must occur on a separate line. \LMHash{} must occur immediately | 7841 must occur on a separate line. \LMHash{} must occur immediately |
7842 before the associated paragraph, and \LMLabel must occur immediately | 7842 before the associated paragraph, and \LMLabel must occur immediately |
7843 after the associated \section{}, \subsection{} etc. | 7843 after the associated \section{}, \subsection{} etc. |
7844 | 7844 |
7845 ---------------------------------------------------------------------- | 7845 ---------------------------------------------------------------------- |
OLD | NEW |