Index: docs/language/dartLangSpec.tex |
diff --git a/docs/language/dartLangSpec.tex b/docs/language/dartLangSpec.tex |
index 0b76367151cb8dc4d241284cec129433f7401bc4..d0da3c1b186ffa7c0df17990bb87382980516559 100644 |
--- a/docs/language/dartLangSpec.tex |
+++ b/docs/language/dartLangSpec.tex |
@@ -1227,7 +1227,11 @@ A {\em constructor parameter list} is a parenthesized, comma-separated list of f |
If an explicit type is attached to the initializing formal, that is its static type. Otherwise, the type of an initializing formal named \code{id} is $T_{id}$, where $T_{id}$ is the type of the field named \code{id} in the immediately enclosing class. It is a static warning if the static type of \code{id} is not assignable to $T_{id}$. |
\LMHash{} |
-Using an initializing formal \code{\THIS{}.id} in a formal parameter list does not introduce a formal parameter name into the scope of the constructor. However, the initializing formal does effect the type of the constructor function exactly as if a formal parameter named \code{id} of the same type were introduced in the same position. |
+Initializing formals constitute an exception to the rule that every formal parameter introduces a local variable into the formal parameter scope (\ref{formalParameters}). When the formal parameter list of a non-redirecting generative constructor contains any initializing formals a new scope is introduced, the {\em formal parameter initializer scope}, which is the current scope of the initializer list of the constructor, and which is enclosed in the scope where the constructor is declared. Each initializing formal in the formal parameter list introduces a local variable into the formal parameter initializer scope, but not into the formal parameter scope; every other formal parameter introduces a local variable into both the formal parameter scope and the formal parameter initializer scope. |
Lasse Reichstein Nielsen
2016/08/23 06:55:20
Consider splitting this into more lines.
I believe
Lasse Reichstein Nielsen
2016/08/23 07:15:03
I can't see anything saying that the initializing-
eernst
2016/08/23 16:26:30
I believe that this has now been covered by adding
eernst
2016/08/23 16:26:30
TeX/LaTeX is perfectly happy (it takes two consecu
|
+ |
+\commentary{ |
+This means that formal parameters including initializing formals must have distinct names, and that initializing formals are in scope for initializers, but they are not in scope for the body of the constructor. The type of the constructor is defined in terms of its formal parameters, including the initializing formals. |
Lasse Reichstein Nielsen
2016/08/23 06:55:20
commas around "including initializing formals".
"i
eernst
2016/08/23 16:26:30
Done.
|
+} |
\LMHash{} |
Initializing formals are executed during the execution of generative constructors detailed below. Executing an initializing formal \code{\THIS{}.id} causes the field \code{id} of the immediately surrounding class to be assigned the value of the corresponding actual parameter, unless $id$ is a final variable that has already been initialized, in which case a runtime error occurs. |