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

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}).
1231 When the formal parameter list of a non-redirecting generative constructor conta ins any initializing formals, a new scope is introduced, the {\em formal paramet er 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 declar ed.
1232 Each initializing formal in the formal parameter list introduces a final local v ariable into the formal parameter initializer scope, but not into the formal par ameter scope; every other formal parameter introduces a local variable into both the formal parameter scope and the formal parameter initializer scope.
1233
1234 \commentary{
1235 This means that formal parameters, including initializing formals, must have dis tinct names, and that initializing formals are in scope for the initializer list , but they are not in scope for the body of the constructor.
1236 When a formal parameter introduces a local variable into two scopes, it is still one variable and hence one storage location.
1237 The type of the constructor is defined in terms of its formal parameters, includ ing the initializing formals.
1238 }
1231 1239
1232 \LMHash{} 1240 \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. 1241 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 1242
1235 1243
1236 \commentary{ 1244 \commentary{
1237 The above rule allows initializing formals to be used as optional parameters: 1245 The above rule allows initializing formals to be used as optional parameters:
1238 } 1246 }
1239 1247
1240 \begin{dartCode} 1248 \begin{dartCode}
(...skipping 6648 matching lines...) Expand 10 before | Expand all | Expand 10 after
7889 7897
7890 The invariant that each normative paragraph is associated with a line 7898 The invariant that each normative paragraph is associated with a line
7891 containing the text \LMHash{} should be maintained. Extra occurrences 7899 containing the text \LMHash{} should be maintained. Extra occurrences
7892 of \LMHash{} can be added if needed, e.g., in order to make 7900 of \LMHash{} can be added if needed, e.g., in order to make
7893 individual \item{}s in itemized lists addressable. Each \LM.. command 7901 individual \item{}s in itemized lists addressable. Each \LM.. command
7894 must occur on a separate line. \LMHash{} must occur immediately 7902 must occur on a separate line. \LMHash{} must occur immediately
7895 before the associated paragraph, and \LMLabel must occur immediately 7903 before the associated paragraph, and \LMLabel must occur immediately
7896 after the associated \section{}, \subsection{} etc. 7904 after the associated \section{}, \subsection{} etc.
7897 7905
7898 ---------------------------------------------------------------------- 7906 ----------------------------------------------------------------------
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