Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1266)

Unified Diff: docs/language/dartLangSpec.tex

Issue 2190373002: Adjusted the spec to include access to initializing formals. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: docs/language/dartLangSpec.tex
diff --git a/docs/language/dartLangSpec.tex b/docs/language/dartLangSpec.tex
index 0b76367151cb8dc4d241284cec129433f7401bc4..d4adf323cbbb140cdf84c3311bac9cd707735509 100644
--- a/docs/language/dartLangSpec.tex
+++ b/docs/language/dartLangSpec.tex
@@ -1227,7 +1227,14 @@ 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.
+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 \code{\THIS{}.id} in the formal parameter list introduces a formal parameter name into the formal parameter initializer scope, but not into the formal parameter scope.
Lasse Reichstein Nielsen 2016/08/08 08:22:06 This does not specify what that name will be bound
eernst 2016/08/08 15:40:57 I think the binding is already specified in the sp
+
+\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.
Lasse Reichstein Nielsen 2016/08/08 08:22:06 I don't see how this can be concluded from the pre
eernst 2016/08/08 15:40:57 I think this problem has been resolved with the ch
+}
+
+\LMHash{}
+The type of the constructor function is derived from the formal parameter initializer scope such that it takes all parameters into account, including initializing formals.
Lasse Reichstein Nielsen 2016/08/08 08:22:06 Is this necessary? (That is: Was the type of a con
eernst 2016/08/08 15:40:57 I think you are right: We can omit this. Sect. 9.3
\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.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698