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

Side by Side 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: Review response Created 4 years, 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1209 matching lines...) Expand 10 before | Expand all | Expand 10 after
1220 . 1220 .
1221 \end{grammar} 1221 \end{grammar}
1222 1222
1223 \LMHash{} 1223 \LMHash{}
1224 A {\em constructor parameter list} is a parenthesized, comma-separated list of f ormal constructor parameters. A {\em formal constructor parameter} is either a f ormal parameter (\ref{formalParameters}) or an initializing formal. An {\em init ializing formal} has the form \code{\THIS{}.id}, where \code{id} is the name of an instance variable of the immediately enclosing class. It is a compile-time e rror if \code{id} is not an instance variable of the immediately enclosing class . It is a compile-time error if an initializing formal is used by a function oth er than a non-redirecting generative constructor. 1224 A {\em constructor parameter list} is a parenthesized, comma-separated list of f ormal constructor parameters. A {\em formal constructor parameter} is either a f ormal parameter (\ref{formalParameters}) or an initializing formal. An {\em init ializing formal} has the form \code{\THIS{}.id}, where \code{id} is the name of an instance variable of the immediately enclosing class. It is a compile-time e rror if \code{id} is not an instance variable of the immediately enclosing class . It is a compile-time error if an initializing formal is used by a function oth er than a non-redirecting generative constructor.
1225 1225
1226 \LMHash{} 1226 \LMHash{}
1227 If an explicit type is attached to the initializing formal, that is its static t ype. 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 enclo sing class. It is a static warning if the static type of \code{id} is not assign able to $T_{id}$. 1227 If an explicit type is attached to the initializing formal, that is its static t ype. 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 enclo sing class. It is a static warning if the static type of \code{id} is not assign able to $T_{id}$.
1228 1228
1229 \LMHash{} 1229 \LMHash{}
1230 Using an initializing formal \code{\THIS{}.id} in a formal parameter list does n ot introduce a formal parameter name into the scope of the constructor. However, the initializing formal does effect the type of the constructor function exactl y as if a formal parameter named \code{id} of the same type were introduced in the same position. 1230 Initializing formals constitute an exception to the rule that every formal param eter introduces a local variable into the formal parameter scope (\ref{formalPar ameters}). When the formal parameter list of a non-redirecting generative constr uctor contains any initializing formals a new scope is introduced, the {\em form al parameter initializer scope}, which is the current scope of the initializer l ist 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 fo rmal parameter scope; every other formal parameter introduces a local variable i nto 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
1231
1232 \commentary{
1233 This means that formal parameters including initializing formals must have disti nct 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 i s 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.
1234 }
1231 1235
1232 \LMHash{} 1236 \LMHash{}
1233 Initializing formals are executed during the execution of generative constructor s detailed below. Executing an initializing formal \code{\THIS{}.id} causes the field \code{id} of the immediately surrounding class to be assigned the value o f the corresponding actual parameter, unless $id$ is a final variable that has a lready been initialized, in which case a runtime error occurs. 1237 Initializing formals are executed during the execution of generative constructor s detailed below. Executing an initializing formal \code{\THIS{}.id} causes the field \code{id} of the immediately surrounding class to be assigned the value o f the corresponding actual parameter, unless $id$ is a final variable that has a lready been initialized, in which case a runtime error occurs.
1234 1238
1235 1239
1236 \commentary{ 1240 \commentary{
1237 The above rule allows initializing formals to be used as optional parameters: 1241 The above rule allows initializing formals to be used as optional parameters:
1238 } 1242 }
1239 1243
1240 \begin{dartCode} 1244 \begin{dartCode}
(...skipping 6648 matching lines...) Expand 10 before | Expand all | Expand 10 after
7889 7893
7890 The invariant that each normative paragraph is associated with a line 7894 The invariant that each normative paragraph is associated with a line
7891 containing the text \LMHash{} should be maintained. Extra occurrences 7895 containing the text \LMHash{} should be maintained. Extra occurrences
7892 of \LMHash{} can be added if needed, e.g., in order to make 7896 of \LMHash{} can be added if needed, e.g., in order to make
7893 individual \item{}s in itemized lists addressable. Each \LM.. command 7897 individual \item{}s in itemized lists addressable. Each \LM.. command
7894 must occur on a separate line. \LMHash{} must occur immediately 7898 must occur on a separate line. \LMHash{} must occur immediately
7895 before the associated paragraph, and \LMLabel must occur immediately 7899 before the associated paragraph, and \LMLabel must occur immediately
7896 after the associated \section{}, \subsection{} etc. 7900 after the associated \section{}, \subsection{} etc.
7897 7901
7898 ---------------------------------------------------------------------- 7902 ----------------------------------------------------------------------
OLDNEW
« 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