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

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

Issue 2375913002: Add documentation to the mixin superclass requirement description. (Closed)
Patch Set: Created 4 years, 2 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 2065 matching lines...) Expand 10 before | Expand all | Expand 10 after
2076 2076
2077 \LMHash{} 2077 \LMHash{}
2078 Let $K$ be a class declaration with the same constructors, superclass and inter faces as $C$, and the instance members declared by $M$ (respectively $M_1, \ldo ts, M_k$). It is a static warning if the declaration of $K$ would cause a static warning. It is a compile-time error if the declaration of $K$ would cause a co mpile-time error. 2078 Let $K$ be a class declaration with the same constructors, superclass and inter faces as $C$, and the instance members declared by $M$ (respectively $M_1, \ldo ts, M_k$). It is a static warning if the declaration of $K$ would cause a static warning. It is a compile-time error if the declaration of $K$ would cause a co mpile-time error.
2079 2079
2080 \commentary{ 2080 \commentary{
2081 If, for example, $M$ declares an instance member $im$ whose type is at odds with the type of a member of the same name in $S$, this will result in a static warn ing just as if we had defined $K$ by means of an ordinary class declaration exte nding $S$, with a body that included $im$. 2081 If, for example, $M$ declares an instance member $im$ whose type is at odds with the type of a member of the same name in $S$, this will result in a static warn ing just as if we had defined $K$ by means of an ordinary class declaration exte nding $S$, with a body that included $im$.
2082 2082
2083 } 2083 }
2084 2084
2085 \LMHash{} 2085 \LMHash{}
2086 The effect of a class definition of the form \code{\CLASS{} $C$ = $M$; } or the form 2086 The effect of a class definition of the form \code{\CLASS{} $C$ = $M$; } or the form \code{\CLASS{} $C<T_1, \ldots, T_n>$ = $M$; } in library $L$ is to introdu ce the name $C$ into the scope of $L$, bound to the class (\ref{classes}) define d by the mixin application $M$. The name of the class is also set to $C$. Iff th e class is prefixed by the built-in identifier \ABSTRACT{}, the class being def ined is an abstract class.
eernst 2016/09/28 12:20:31 OK, let's keep it like this: It looks like this is
Lasse Reichstein Nielsen 2016/09/29 06:54:50 Acknowledged.
2087 \code{\CLASS{} $C<T_1, \ldots, T_n>$ = $M$; } in library $L$ is to introduce t he name $C$ into the scope of $L$, bound to the class (\ref{classes}) defined by the mixin application $M$. The name of the class is also set to $C$. Iff the c lass is prefixed by the built-in identifier \ABSTRACT{}, the class being defined is an abstract class.
2088 2087
2089 Let $M_A$ be a mixin derived from a class $M$ with direct superclass $S_{static }$. 2088 Let $M_A$ be a mixin derived from a class $M$ with direct superclass $S_{static} $, e.g., as defined by the class declaration \code{class M extends S$_{static}$ \{ \ldots \}}.
2090 2089
2091 Let $A$ be an application of $M_A$. It is a static warning if the superclass of $A$ is not a subtype of $S_{static}$. 2090 Let $A$ be an application of $M_A$. It is a static warning if the superclass of $A$ is not a subtype of $S_{static}$.
2092 2091
2093 Let $C$ be a class declaration that includes $M_A$ in a with clause. It is a sta tic warning if $C$ does not implement, directly or indirectly, all the direct su perinterfaces of $M$. 2092 Let $C$ be a class declaration that includes $M_A$ in a with clause. It is a sta tic warning if $C$ does not implement, directly or indirectly, all the direct su perinterfaces of $M$.
2094 2093
2095 2094
2096 \subsection{Mixin Composition} 2095 \subsection{Mixin Composition}
2097 \LMLabel{mixinComposition} 2096 \LMLabel{mixinComposition}
2098 2097
2099 \rationale{ 2098 \rationale{
(...skipping 765 matching lines...) Expand 10 before | Expand all | Expand 10 after
2865 2864
2866 \begin{grammar} 2865 \begin{grammar}
2867 {\bf symbolLiteral:} 2866 {\bf symbolLiteral:}
2868 `\#' (operator $|$ (identifier (`{\escapegrammar .}' identifier)*)) . 2867 `\#' (operator $|$ (identifier (`{\escapegrammar .}' identifier)*)) .
2869 \end{grammar} 2868 \end{grammar}
2870 2869
2871 \LMHash{} 2870 \LMHash{}
2872 A symbol literal \code{\#id} where \code{id} does not begin with an underscore ( '\code{\_}') is equivalent to the expression \code{\CONST{} Symbol('id')}. 2871 A symbol literal \code{\#id} where \code{id} does not begin with an underscore ( '\code{\_}') is equivalent to the expression \code{\CONST{} Symbol('id')}.
2873 2872
2874 \LMHash{} 2873 \LMHash{}
2875 A symbol literal \code{\#\_id} evaluates to the object that would be returned by the call \code{MirrorSystem.getSymbol('_id', libraryMirror)} where \code{librar yMirror} is an instance of the class \code{LibraryMirror} defined in the library \code{dart:mirrors}, reflecting the current library. 2874 A symbol literal \code{\#\_id} evaluates to the object that would be returned by the call \code{MirrorSystem.getSymbol("\_id", libraryMirror)} where \code{libra ryMirror} is an instance of the class \code{LibraryMirror} defined in the librar y \code{dart:mirrors}, reflecting the current library.
eernst 2016/09/28 12:20:31 Thinking .. aha, this is a fix to the fix (it used
Lasse Reichstein Nielsen 2016/09/29 06:54:50 Acknowledged.
2876 2875
2877 \rationale{ 2876 \rationale{
2878 One may well ask what is the motivation for introducing literal symbols? In some languages, symbols are canonicalized whereas strings are not. However literal s trings are already canonicalized in Dart. Symbols are slightly easier to type c ompared to strings and their use can become strangely addictive, but this is not nearly sufficient justification for adding a literal form to the language. The primary motivation is related to the use of reflection and a web specific practi ce known as minification. 2877 One may well ask what is the motivation for introducing literal symbols? In some languages, symbols are canonicalized whereas strings are not. However literal s trings are already canonicalized in Dart. Symbols are slightly easier to type c ompared to strings and their use can become strangely addictive, but this is not nearly sufficient justification for adding a literal form to the language. The primary motivation is related to the use of reflection and a web specific practi ce known as minification.
2879 2878
2880 Minification compresses identifiers consistently throughout a program in order t o reduce download size. This practice poses difficulties for reflective program s that refer to program declarations via strings. A string will refer to an iden tifier in the source, but the identifier will no longer be used in the minified code, and reflective code using these would fail. Therefore, Dart reflection us es objects of type \code{Symbol} rather than strings. Instances of \code{Symbol } are guaranteed to be stable with repeat to minification. Providing a literal f orm for symbols makes reflective code easier to read and write. The fact that sy mbols are easy to type and can often act as convenient substitutes for enums are secondary benefits. 2879 Minification compresses identifiers consistently throughout a program in order t o reduce download size. This practice poses difficulties for reflective program s that refer to program declarations via strings. A string will refer to an iden tifier in the source, but the identifier will no longer be used in the minified code, and reflective code using these would fail. Therefore, Dart reflection us es objects of type \code{Symbol} rather than strings. Instances of \code{Symbol } are guaranteed to be stable with repeat to minification. Providing a literal f orm for symbols makes reflective code easier to read and write. The fact that sy mbols are easy to type and can often act as convenient substitutes for enums are secondary benefits.
2881 } 2880 }
2882 2881
2883 \LMHash{} 2882 \LMHash{}
2884 The static type of a symbol literal is \code{Symbol}. 2883 The static type of a symbol literal is \code{Symbol}.
2885 2884
(...skipping 5011 matching lines...) Expand 10 before | Expand all | Expand 10 after
7897 7896
7898 The invariant that each normative paragraph is associated with a line 7897 The invariant that each normative paragraph is associated with a line
7899 containing the text \LMHash{} should be maintained. Extra occurrences 7898 containing the text \LMHash{} should be maintained. Extra occurrences
7900 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
7901 individual \item{}s in itemized lists addressable. Each \LM.. command 7900 individual \item{}s in itemized lists addressable. Each \LM.. command
7902 must occur on a separate line. \LMHash{} must occur immediately 7901 must occur on a separate line. \LMHash{} must occur immediately
7903 before the associated paragraph, and \LMLabel must occur immediately 7902 before the associated paragraph, and \LMLabel must occur immediately
7904 after the associated \section{}, \subsection{} etc. 7903 after the associated \section{}, \subsection{} etc.
7905 7904
7906 ---------------------------------------------------------------------- 7905 ----------------------------------------------------------------------
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