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

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

Issue 42513003: Clarify that sttaic getters that pair with instance setters cause warnings even if they are implici… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 1 month 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 | Annotate | Revision Log
« 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{dart} 3 \usepackage{dart}
4 \usepackage{bnf} 4 \usepackage{bnf}
5 \usepackage{hyperref} 5 \usepackage{hyperref}
6 \newcommand{\code}[1]{{\sf #1}} 6 \newcommand{\code}[1]{{\sf #1}}
7 \title{Dart Programming Language Specification \\ 7 \title{Dart Programming Language Specification \\
8 {\large Draft Version 0.71}} 8 {\large Draft Version 0.71}}
9 \author{The Dart Team} 9 \author{The Dart Team}
10 \begin{document} 10 \begin{document}
(...skipping 1349 matching lines...) Expand 10 before | Expand all | Expand 10 after
1360 1360
1361 The instance getters of a class $C$ are those instance getters declared by $C$, either implicitly or explicitly, and the instance getters inherited by $C$ from its superclass. The static getters of a class $C$ are those static getters decla red by $C$. 1361 The instance getters of a class $C$ are those instance getters declared by $C$, either implicitly or explicitly, and the instance getters inherited by $C$ from its superclass. The static getters of a class $C$ are those static getters decla red by $C$.
1362 1362
1363 It is a compile-time error if a class has both a getter and a method with the sa me name. This restriction holds regardless of whether the getter is defined expl icitly or implicitly, or whether the getter or the method are inherited or not. 1363 It is a compile-time error if a class has both a getter and a method with the sa me name. This restriction holds regardless of whether the getter is defined expl icitly or implicitly, or whether the getter or the method are inherited or not.
1364 1364
1365 \commentary{ 1365 \commentary{
1366 This implies that a getter can never override a method, and a method can never o verride a getter or field. 1366 This implies that a getter can never override a method, and a method can never o verride a getter or field.
1367 } 1367 }
1368 1368
1369 It is a static warning if a getter $m_1$ overrides (\ref{inheritanceAndOverridi ng}) a getter 1369 It is a static warning if a getter $m_1$ overrides (\ref{inheritanceAndOverridi ng}) a getter
1370 $m_2$ and the type of $m_1$ is not a subtype of the type of $m_2$. It is a sta tic warning if a class declares a static getter named $v$ and also has a non-st atic setter named $v=$. It is a static warning if a class $C$ declares an instan ce getter named $v$ and an accessible static member named $v$ or $v=$ is declare d in a superclass of $C$. 1370 $m_2$ and the type of $m_1$ is not a subtype of the type of $m_2$.
1371
1372 It is a static warning if a class declares a static getter named $v$ and also h as a non-static setter named $v=$. It is a static warning if a class $C$ declare s an instance getter named $v$ and an accessible static member named $v$ or $v=$ is declared in a superclass of $C$. These warnings must be issued regardless of whether the getters or setters are declared explicitly or implicitly.
1371 1373
1372 \subsection{Setters} 1374 \subsection{Setters}
1373 \label{setters} 1375 \label{setters}
1374 1376
1375 Setters are functions (\ref{functions}) that are used to set the values of objec t properties. 1377 Setters are functions (\ref{functions}) that are used to set the values of objec t properties.
1376 1378
1377 % what about top level ones? Same for getters 1379 % what about top level ones? Same for getters
1378 1380
1379 \begin{grammar} 1381 \begin{grammar}
1380 {\bf setterSignature:} 1382 {\bf setterSignature:}
1381 returnType? \SET{} identifier formalParameterList 1383 returnType? \SET{} identifier formalParameterList
1382 . 1384 .
1383 \end{grammar} 1385 \end{grammar}
1384 1386
1385 If no return type is specified, the return type of the setter is \DYNAMIC{}. 1387 If no return type is specified, the return type of the setter is \DYNAMIC{}.
1386 1388
1387 A setter definition that is prefixed with the \STATIC{} modifier defines a stati c setter. Otherwise, it defines an instance setter. The name of a setter is obt ained by appending the string `=' to the identifier given in its signature. 1389 A setter definition that is prefixed with the \STATIC{} modifier defines a stati c setter. Otherwise, it defines an instance setter. The name of a setter is obt ained by appending the string `=' to the identifier given in its signature.
1388 1390
1389 \commentary{Hence, a setter name can never conflict with, override or be overrid den by a getter or method.} 1391 \commentary{Hence, a setter name can never conflict with, override or be overrid den by a getter or method.}
1390 1392
1391 The instance setters of a class $C$ are those instance setters declared by $C$ e ither implicitly or explicitly, and the instance setters inherited by $C$ from i ts superclass. The static setters of a class $C$ are those static setters declar ed by $C$. 1393 The instance setters of a class $C$ are those instance setters declared by $C$ e ither implicitly or explicitly, and the instance setters inherited by $C$ from i ts superclass. The static setters of a class $C$ are those static setters declar ed by $C$.
1392 1394
1393 It is a compile-time error if a setter's formal parameter list does not consist of exactly one required formal parameter $p$. \rationale{We could enforce this via the grammar, but we`d have to specify the evaluation rules in that case.} 1395 It is a compile-time error if a setter's formal parameter list does not consist of exactly one required formal parameter $p$. \rationale{We could enforce this via the grammar, but we`d have to specify the evaluation rules in that case.}
1394 1396
1395 %It is a compile-time error if a class has both a setter and a method with the s ame name. This restriction holds regardless of whether the setter is defined exp licitly or implicitly, or whether the setter or the method are inherited or not. 1397 %It is a compile-time error if a class has both a setter and a method with the s ame name. This restriction holds regardless of whether the setter is defined exp licitly or implicitly, or whether the setter or the method are inherited or not.
1396 1398
1397 It is a static warning if a setter declares a return type other than \VOID{}. 1399 It is a static warning if a setter declares a return type other than \VOID{}.
1398 It is a static warning if a setter $m_1$ overrides (\ref{inheritanceAndOverridi ng}) a setter $m_2$ and the type of $m_1$ is not a subtype of the type of $m_2$. It is a static warning if a class has a setter named $v=$ with argument type $T $ and a getter named $v$ with return type $S$, and $T$ may not be assigned to $S $. It is a static warning if a class declares a static setter named $v=$ and al so has a non-static member named $v$. It is a static warning if a class $C$ decl ares an instance setter named $v=$ and an accessible static member named $v=$ or $v$ is declared in a superclass of $C$. 1400 It is a static warning if a setter $m_1$ overrides (\ref{inheritanceAndOverridi ng}) a setter $m_2$ and the type of $m_1$ is not a subtype of the type of $m_2$. It is a static warning if a class has a setter named $v=$ with argument type $T $ and a getter named $v$ with return type $S$, and $T$ may not be assigned to $S $.
1401
1402 It is a static warning if a class declares a static setter named $v=$ and also has a non-static member named $v$. It is a static warning if a class $C$ declare s an instance setter named $v=$ and an accessible static member named $v=$ or $v $ is declared in a superclass of $C$.
1403
1404 These warnings must be issued regardless of whether the getters or setters are d eclared explicitly or implicitly.
1399 1405
1400 \subsection{Abstract Instance Members} 1406 \subsection{Abstract Instance Members}
1401 \label{abstractInstanceMembers} 1407 \label{abstractInstanceMembers}
1402 1408
1403 An {\em abstract method} (respectively, {\em abstract getter} or {\em abstract s etter)} is an instance method, getter or setter that is not declared \EXTERNAL{} and does not provide an implementation. An {\em concrete method} (respectively , {\em concrete getter} or {\em concrete setter)} is an instance method, getter or setter that is not abstract. 1409 An {\em abstract method} (respectively, {\em abstract getter} or {\em abstract s etter)} is an instance method, getter or setter that is not declared \EXTERNAL{} and does not provide an implementation. An {\em concrete method} (respectively , {\em concrete getter} or {\em concrete setter)} is an instance method, getter or setter that is not abstract.
1404 %The declaration of an abstract method is prefixed by the built-in identifier (\ ref{identifierReference}) \ABSTRACT{}. 1410 %The declaration of an abstract method is prefixed by the built-in identifier (\ ref{identifierReference}) \ABSTRACT{}.
1405 1411
1406 \rationale{ 1412 \rationale{
1407 Earlier versions of Dart required that abstract members be identified by prefixi ng them with the modifier \ABSTRACT{}. The elimination of this requirement is m otivated by the desire to use abstract classes as interfaces. Every Dart class i nduces an implicit interface. 1413 Earlier versions of Dart required that abstract members be identified by prefixi ng them with the modifier \ABSTRACT{}. The elimination of this requirement is m otivated by the desire to use abstract classes as interfaces. Every Dart class i nduces an implicit interface.
1408 1414
(...skipping 4172 matching lines...) Expand 10 before | Expand all | Expand 10 after
5581 This ensures that the developer is spared a series of cascading warnings as the malformed type interacts with other types. 5587 This ensures that the developer is spared a series of cascading warnings as the malformed type interacts with other types.
5582 } 5588 }
5583 5589
5584 \subsubsection{Type Promotion} 5590 \subsubsection{Type Promotion}
5585 \label{typePromotion} 5591 \label{typePromotion}
5586 5592
5587 The static type system ascribes a static type to every expression. In some case s, the types of local variables and formal parameters may be promoted from their declared types based on control flow. 5593 The static type system ascribes a static type to every expression. In some case s, the types of local variables and formal parameters may be promoted from their declared types based on control flow.
5588 5594
5589 We say that a variable $v$ is known to have type $T$ whenever we allow the type of $v$ to be promoted. The exact circumstances when type promotion is allowed ar e given in the relevant sections of the specification (\ref{logicalBooleanExpres sions}, \ref{conditional} and \ref{if}). 5595 We say that a variable $v$ is known to have type $T$ whenever we allow the type of $v$ to be promoted. The exact circumstances when type promotion is allowed ar e given in the relevant sections of the specification (\ref{logicalBooleanExpres sions}, \ref{conditional} and \ref{if}).
5590 5596
5591 Type promotion for a variable v is allowed only when we can deduce that such pro motion is valid based on an analysis of certain boolean expressions. In such cas es, we say that the boolean expression b shows that v has type T. As a rule, for all variables v and types T, a boolean expression does not show that v has type T. Those situations where an expression does show that a variable has a type ar e mentioned explicitly in the relevant sections of this specification (\ref{type Test} and \ref{logicalBooleanExpressions}). 5597 Type promotion for a variable $v$ is allowed only when we can deduce that such p romotion is valid based on an analysis of certain boolean expressions. In such c ases, we say that the boolean expression $b$ shows that $v$ has type $T$. As a r ule, for all variables $v$ and types $T$, a boolean expression does not show tha t $v$ has type $T$. Those situations where an expression does show that a variab le has a type are mentioned explicitly in the relevant sections of this specific ation (\ref{typeTest} and \ref{logicalBooleanExpressions}).
5592 5598
5593 5599
5594 \subsection{Dynamic Type System} 5600 \subsection{Dynamic Type System}
5595 \label{dynamicTypeSystem} 5601 \label{dynamicTypeSystem}
5596 5602
5597 A Dart implementation must support execution in both {\em production mode} and { \em checked mode}. Those dynamic checks specified as occurring specifically in checked mode must be performed iff the code is executed in checked mode. 5603 A Dart implementation must support execution in both {\em production mode} and { \em checked mode}. Those dynamic checks specified as occurring specifically in checked mode must be performed iff the code is executed in checked mode.
5598 5604
5599 %It is a run-time type error to access an undeclared type outside . 5605 %It is a run-time type error to access an undeclared type outside .
5600 5606
5601 %It is a dynamic type error if a malformed type is used in a subtype test. 5607 %It is a dynamic type error if a malformed type is used in a subtype test.
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after
6155 \item The names of compile time constant variables never use lower case letters. If they consist of multiple words, those words are separated by underscores. Ex amples: PI, I\_AM\_A\_CONSTANT. 6161 \item The names of compile time constant variables never use lower case letters. If they consist of multiple words, those words are separated by underscores. Ex amples: PI, I\_AM\_A\_CONSTANT.
6156 \item The names of functions (including getters, setters, methods and local or l ibrary functions) and non-constant variables begin with a lowercase letter. If t he name consists of multiple words, each word (except the first) begins with an uppercase letter. No other uppercase letters are used. Examples: camlCase, dar t4TheWorld 6162 \item The names of functions (including getters, setters, methods and local or l ibrary functions) and non-constant variables begin with a lowercase letter. If t he name consists of multiple words, each word (except the first) begins with an uppercase letter. No other uppercase letters are used. Examples: camlCase, dar t4TheWorld
6157 \item The names of types (including classes and type aliases) begin with an uppe r case letter. If the name consists of multiple words, each word begins with an uppercase letter. No other uppercase letters are used. Examples: CamlCase, D art4TheWorld. 6163 \item The names of types (including classes and type aliases) begin with an uppe r case letter. If the name consists of multiple words, each word begins with an uppercase letter. No other uppercase letters are used. Examples: CamlCase, D art4TheWorld.
6158 \item The names of type variables are short (preferably single letter). Examples : T, S, K, V , E. 6164 \item The names of type variables are short (preferably single letter). Examples : T, S, K, V , E.
6159 \item The names of libraries or library prefixes never use upper case letters. I f they consist of multiple words, those words are separated by underscores. Exam ple: my\_favorite\_library. 6165 \item The names of libraries or library prefixes never use upper case letters. I f they consist of multiple words, those words are separated by underscores. Exam ple: my\_favorite\_library.
6160 \end{itemize} 6166 \end{itemize}
6161 } 6167 }
6162 6168
6163 6169
6164 \end{document} 6170 \end{document}
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