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

Side by Side Diff: docs/language/dartLangSpec.tex

Issue 2843733002: Adjusted initializer rules, changing a run-time error to compile-time. (Closed)
Patch Set: Review response: Added missing case. Created 3 years, 7 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 \usepackage[T1]{fontenc} 8 \usepackage[T1]{fontenc}
9 \newcommand{\code}[1]{{\sf #1}} 9 \newcommand{\code}[1]{{\sf #1}}
10 \title{Dart Programming Language Specification \\ 10 \title{Dart Programming Language Specification \\
(...skipping 1395 matching lines...) Expand 10 before | Expand all | Expand 10 after
1406 fieldInitializer 1406 fieldInitializer
1407 . 1407 .
1408 1408
1409 {\bf fieldInitializer:} 1409 {\bf fieldInitializer:}
1410 (\THIS{} `{\escapegrammar .}')? identifier `=' conditionalExpression casca deSection* 1410 (\THIS{} `{\escapegrammar .}')? identifier `=' conditionalExpression casca deSection*
1411 . 1411 .
1412 1412
1413 \end{grammar} 1413 \end{grammar}
1414 1414
1415 \LMHash{} 1415 \LMHash{}
1416 Let $k$ be a generative constructor. Then $k$ may include at most one superini tializer in its initializer list or a compile-time error occurs. If no superinit ializer is provided, an implicit superinitializer of the form \SUPER{}() is adde d at the end of $k$'s initializer list, unless the enclosing class is class \cod e{Object}. It is a compile-time error if more than one initializer corresponding to a given instance variable appears in $k$'s initializer list. It is a compile -time error if $k$'s initializer list contains an initializer for a variable tha t is initialized by means of an initializing formal of $k$. % It is a compile-ti me error if $k$'s initializer list contains an initializer for a final variable $f$ whose declaration includes an initialization expression. 1416 Let $k$ be a generative constructor.
1417 Then $k$ may include at most one superinitializer in its initializer list or a c ompile-time error occurs.
1418 If no superinitializer is provided, an implicit superinitializer of the form \SU PER{}() is added at the end of $k$'s initializer list,
1419 unless the enclosing class is class \code{Object}.
1420 It is a compile-time error if more than one initializer corresponding to a given instance variable appears in $k$'s initializer list.
1421 It is a compile-time error if $k$'s initializer list contains an initializer for a variable that is initialized by means of an initializing formal of $k$.
1422 It is a compile-time error if $k$'s initializer list contains an initializer for a final variable $f$ whose declaration includes an initialization expression.
1423 It is a compile-time error if $k$ includes an initializing formal for a final va riable $f$ whose declaration includes an initialization expression.
1417 1424
1418 \LMHash{} 1425 \LMHash{}
1419 Each final instance variable $f$ declared in the immediately enclosing class mus t have an initializer in $k$'s initializer list unless it has already been initi alized by one of the following means: 1426 Each final instance variable $f$ declared in the immediately enclosing class mus t have an initializer in $k$'s initializer list unless it has already been initi alized by one of the following means:
1420 \begin{itemize} 1427 \begin{itemize}
1421 \item Initialization at the declaration of $f$. 1428 \item Initialization at the declaration of $f$.
1422 \item Initialization by means of an initializing formal of $k$. 1429 \item Initialization by means of an initializing formal of $k$.
1423 \end{itemize} 1430 \end{itemize}
1424 1431
1425 or a static warning occurs. It is a compile-time error if $k$'s initializer list contains an initializer for a variable that is not an instance variable declare d in the immediately surrounding class. 1432 or a static warning occurs. It is a compile-time error if $k$'s initializer list contains an initializer for a variable that is not an instance variable declare d in the immediately surrounding class.
1426 1433
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
1492 an instance method cannot be directly invoked, nor can \THIS{} be passed into an y other code being invoked in the initializer. 1499 an instance method cannot be directly invoked, nor can \THIS{} be passed into an y other code being invoked in the initializer.
1493 } 1500 }
1494 1501
1495 \LMHash{} 1502 \LMHash{}
1496 During the execution of a generative constructor to initialize an instance $i$, 1503 During the execution of a generative constructor to initialize an instance $i$,
1497 execution of an initializer of the form \code{\THIS{}.$v$ = $e$} 1504 execution of an initializer of the form \code{\THIS{}.$v$ = $e$}
1498 proceeds as follows: 1505 proceeds as follows:
1499 1506
1500 \LMHash{} 1507 \LMHash{}
1501 First, the expression $e$ is evaluated to an object $o$. 1508 First, the expression $e$ is evaluated to an object $o$.
1502 %%STRONG_MODE: The runtime error in the next sentence will be compile-time. 1509 Then, the instance variable $v$ of $i$ is bound to $o$.
1503 Then, the instance variable $v$ of $i$ is bound to $o$, unless $v$ is a final va riable that has already been initialized, in which case a runtime error occurs.
1504 In checked mode, it is a dynamic type error if $o$ is not \NULL{} and the interf ace of the class of $o$ is not a subtype of the actual type of the instance vari able $v$. 1510 In checked mode, it is a dynamic type error if $o$ is not \NULL{} and the interf ace of the class of $o$ is not a subtype of the actual type of the instance vari able $v$.
1505 1511
1506 \LMHash{} 1512 \LMHash{}
1507 An initializer of the form \code{$v$ = $e$} is equivalent to an initializer of t he form \code{\THIS{}.$v$ = $e$}. 1513 An initializer of the form \code{$v$ = $e$} is equivalent to an initializer of t he form \code{\THIS{}.$v$ = $e$}.
1508 1514
1509 \LMHash{} 1515 \LMHash{}
1510 Execution of a superinitializer of the form 1516 Execution of a superinitializer of the form
1511 1517
1512 \SUPER{}$(a_1, \ldots, a_n, x_{n+1}: a_{n+1}, \ldots, x_{n+k}: a_{n+k})$ 1518 \SUPER{}$(a_1, \ldots, a_n, x_{n+1}: a_{n+1}, \ldots, x_{n+k}: a_{n+k})$
1513 1519
(...skipping 6646 matching lines...) Expand 10 before | Expand all | Expand 10 after
8160 8166
8161 The invariant that each normative paragraph is associated with a line 8167 The invariant that each normative paragraph is associated with a line
8162 containing the text \LMHash{} should be maintained. Extra occurrences 8168 containing the text \LMHash{} should be maintained. Extra occurrences
8163 of \LMHash{} can be added if needed, e.g., in order to make 8169 of \LMHash{} can be added if needed, e.g., in order to make
8164 individual \item{}s in itemized lists addressable. Each \LM.. command 8170 individual \item{}s in itemized lists addressable. Each \LM.. command
8165 must occur on a separate line. \LMHash{} must occur immediately 8171 must occur on a separate line. \LMHash{} must occur immediately
8166 before the associated paragraph, and \LMLabel must occur immediately 8172 before the associated paragraph, and \LMLabel must occur immediately
8167 after the associated \section{}, \subsection{} etc. 8173 after the associated \section{}, \subsection{} etc.
8168 8174
8169 ---------------------------------------------------------------------- 8175 ----------------------------------------------------------------------
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