OLD | NEW |
---|---|
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 Loading... | |
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 When the formal parameter list of a non-redirecting generative constructor conta ins any initializing formals a new scope is introduced, the {\em formal paramete r 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 declare d. Each initializing formal \code{\THIS{}.id} in the formal parameter list intro duces a formal parameter name into the formal parameter initializer scope, but n ot 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
| |
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. | |
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
| |
1234 } | |
1235 | |
1236 \LMHash{} | |
1237 The type of the constructor function is derived from the formal parameter initia lizer scope such that it takes all parameters into account, including initializi ng 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
| |
1231 | 1238 |
1232 \LMHash{} | 1239 \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. | 1240 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 | 1241 |
1235 | 1242 |
1236 \commentary{ | 1243 \commentary{ |
1237 The above rule allows initializing formals to be used as optional parameters: | 1244 The above rule allows initializing formals to be used as optional parameters: |
1238 } | 1245 } |
1239 | 1246 |
1240 \begin{dartCode} | 1247 \begin{dartCode} |
(...skipping 6648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7889 | 7896 |
7890 The invariant that each normative paragraph is associated with a line | 7897 The invariant that each normative paragraph is associated with a line |
7891 containing the text \LMHash{} should be maintained. Extra occurrences | 7898 containing the text \LMHash{} should be maintained. Extra occurrences |
7892 of \LMHash{} can be added if needed, e.g., in order to make | 7899 of \LMHash{} can be added if needed, e.g., in order to make |
7893 individual \item{}s in itemized lists addressable. Each \LM.. command | 7900 individual \item{}s in itemized lists addressable. Each \LM.. command |
7894 must occur on a separate line. \LMHash{} must occur immediately | 7901 must occur on a separate line. \LMHash{} must occur immediately |
7895 before the associated paragraph, and \LMLabel must occur immediately | 7902 before the associated paragraph, and \LMLabel must occur immediately |
7896 after the associated \section{}, \subsection{} etc. | 7903 after the associated \section{}, \subsection{} etc. |
7897 | 7904 |
7898 ---------------------------------------------------------------------- | 7905 ---------------------------------------------------------------------- |
OLD | NEW |