Chromium Code Reviews| Index: docs/language/dartLangSpec.tex |
| =================================================================== |
| --- docs/language/dartLangSpec.tex (revision 42584) |
| +++ docs/language/dartLangSpec.tex (working copy) |
| @@ -758,7 +758,7 @@ |
| \LMLabel{typeOfAFunction} |
| \LMHash{} |
| -If a function does not declare a return type explicitly, its return type is \DYNAMIC{} (\ref{typeDynamic}). |
| +If a function does not declare a return type explicitly, its return type is \DYNAMIC{} (\ref{typeDynamic}), unless it is a constructor function, in which case its return type is the immediately enclosing class. |
| \LMHash{} |
| Let $F$ be a function with required formal parameters $T_1$ $p_1 \ldots, T_n$ $p_n$, return type $T_0$ and no optional parameters. Then the type of $F$ is $(T_1 ,\ldots, T_n) \rightarrow T_0$. |
| @@ -859,12 +859,12 @@ |
| \LMHash{} |
| A class has constructors, instance members and static members. The instance members of a class are its instance methods, getters, setters and instance variables. The static members of a class are its static methods, getters, setters and static variables. The members of a class are its static and instance members. |
| -% A class has a static scope and an instance scope. The enclosing scope of the static scope of a non-generic class is the enclosing scope of the class declaration. The enclosing scope of the static scope of a generic class is the type parameter scope (\ref{}) of the generic class declaration. |
| -%The enclosing scope of a class' instance scope is the class' static scope. |
| +A class has a static scope and an instance scope. The enclosing scope of the static scope of a non-generic class is the enclosing scope of the class declaration. The enclosing scope of the static scope of a generic class is the type parameter scope (\ref{generics}) of the generic class declaration. |
|
Lasse Reichstein Nielsen
2015/01/03 10:31:04
Could it be simpler to let all classes have a type
gbracha
2015/01/05 21:32:10
Done.
|
| +The enclosing scope of a class' instance scope is the class' static scope. |
| -%The enclosing scope of an instance member declaration is the instance scope of the class in which it is declared. |
| +The enclosing scope of an instance member declaration is the instance scope of the class in which it is declared. |
| -%The enclosing scope of a static member declaration is the static scope of the class in which it is declared. |
| +The enclosing scope of a static member declaration is the static scope of the class in which it is declared. |
| \LMHash{} |
| @@ -3285,7 +3285,7 @@ |
| \commentary{Note that it this point we are assured that the number of actual type arguments match the number of formal type parameters.} |
| \LMHash{} |
| -A fresh instance (\ref{generativeConstructors}), $i$, of class $R$ is allocated. For each instance variable $f$ of $i$, if the variable declaration of $f$ has an initializer expression $e_f$, then $e_f$ is evaluated to an object $o_f$ and $f$ is bound to $o_f$. Otherwise $f$ is bound to \NULL{}. |
| +A fresh instance (\ref{generativeConstructors}), $i$, of class $R$ is allocated. For each instance variable $f$ of $i$, if the variable declaration of $f$ has an initializer expression $e_f$, then $e_f$ is evaluated, with the type parameters (if any) of $R$ bound to the actual type arguments $V_1, \ldots, V_l$, to an object $o_f$ and $f$ is bound to $o_f$. Otherwise $f$ is bound to \NULL{}. |
|
Lasse Reichstein Nielsen
2015/01/03 10:31:04
Still doesn't say in which dynamic scope the expre
gbracha
2015/01/05 21:32:10
All instance members are already said to be in the
|
| \commentary{ |
| Observe that \THIS{} is not in scope in $e_f$. Hence, the initialization cannot depend on other properties of the object being instantiated. |
| @@ -4013,7 +4013,7 @@ |
| \commentary{Observations: |
| \begin{enumerate} |
| \item One cannot closurize a getter or a setter. |
| -\item One can tell whether one implemented a property via a method or via field/getter, which means that one has to plan ahead as to what construct to use, and that choice is reflected in the interface of the class. |
| +\item One can tell whether one implemented a property via a method or via a field/getter, which means that one has to plan ahead as to what construct to use, and that choice is reflected in the interface of the class. |
| \end{enumerate} |
| } |
| @@ -5132,7 +5132,7 @@ |
| identifier \IN{} expression |
| . |
| -{\bf forInitializerStatement:}localVariableDeclaration `{\escapegrammar ;}'; |
| +{\bf forInitializerStatement:}localVariableDeclaration; |
| expression? `{\escapegrammar ;}' |
| . |
| \end{grammar} |
| @@ -7162,7 +7162,7 @@ |
| \hline |
| Logical Or & $||$ & Left & 4\\ |
| \hline |
| -Conditional & e1? e2: e3 & None & 3\\ |
| +Conditional & e1? e2: e3 & Right & 3\\ |
|
Lasse Reichstein Nielsen
2015/01/03 10:31:04
So it's Right because
x ? y : z ? w : v
is
x ?
gbracha
2015/01/05 21:32:10
Yes
|
| \hline |
| Cascade & .. & Left & 2\\ |
| \hline |