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

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

Issue 165483004: Libraries can be private. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 10 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 | 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 Version 1.11}} 8 {\large Version 1.2}}
ahe 2014/02/25 10:28:20 I believe 1.11 is larger than 1.2, so this version
9 \author{The Dart Team} 9 \author{The Dart Team}
10 \begin{document} 10 \begin{document}
11 \maketitle 11 \maketitle
12 12
13 \tableofcontents 13 \tableofcontents
14 14
15 15
16 \newpage 16 \newpage
17 17
18 \pagestyle{myheadings} 18 \pagestyle{myheadings}
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 Good tooling should of course endeavor to inform programmers of such situations (discreetly). For example, an identifier that is both inherited and lexically vi sible could be highlighted (via underlining or colorization). Better yet, tight integration of source control with language aware tools would detect such change s when they occur. 202 Good tooling should of course endeavor to inform programmers of such situations (discreetly). For example, an identifier that is both inherited and lexically vi sible could be highlighted (via underlining or colorization). Better yet, tight integration of source control with language aware tools would detect such change s when they occur.
203 203
204 } 204 }
205 205
206 206
207 207
208 208
209 \subsection{Privacy} 209 \subsection{Privacy}
210 \label{privacy} 210 \label{privacy}
211 211
212 Dart supports two levels of privacy: {\em public} and {\em private}. A declarati on is {\em private} iff its name begins with an underscore (the \_ character) ot herwise it is {\em public.} 212 Dart supports two levels of privacy: {\em public} and {\em private}. A declarat ion is {\em private} iff its name is private, otherwise it is {\em public.} A name $q$ is private iff any one of the identifiers that comprise $q$ is private, otherwise it is {\em public.} An identifier is private iff it
ahe 2014/02/20 15:51:39 What is a "declaration"? What is "its name" (that
213 begins with an underscore (the \_ character) otherwise it is {\em public.}
214
213 A declaration $m$ is {\em accessible to library $L$} if $m$ is declared in $L$ or if $m$ is public. 215 A declaration $m$ is {\em accessible to library $L$} if $m$ is declared in $L$ or if $m$ is public.
214 216
215 \commentary{ 217 \commentary{
216 This means private declarations may only be accessed within the library in which they are declared. 218 This means private declarations may only be accessed within the library in which they are declared.
217 } 219 }
218 220
219 Privacy applies only to declarations within a library, not to library declaratio ns themselves. 221 Privacy applies only to declarations within a library, not to library declaratio ns themselves.
220 222
221 \rationale{ 223 \rationale{Libraries do not reference each other by name and so the idea of a pr ivate library is meaningless.
222 Libraries do not reference each other by name and so the idea of a private libra ry is meaningless. 224 Thus, if the name of a library begins with an underscore, it has no effect on th e accessibility of the library or its members.
223 Thus, if the name of a library begins with an underscore, it has no special sign ificance.
224 } 225 }
225 226
226 \rationale{Privacy is, at this point, a static notion tied to a particular piece of code (a library). It is designed to support software engineering concerns ra ther than security concerns. Untrusted code should always run in an another isol ate. It is possible that libraries will become first class objects and privacy will be a dynamic notion tied to a library instance. 227 \rationale{Privacy is, at this point, a static notion tied to a particular piece of code (a library). It is designed to support software engineering concerns ra ther than security concerns. Untrusted code should always run in an another isol ate. It is possible that libraries will become first class objects and privacy will be a dynamic notion tied to a library instance.
227 228
228 Privacy is indicated by the name of a declaration - hence privacy and naming are not orthogonal. This has the advantage that both humans and machines can recogn ize access to private declarations at the point of use without knowledge of the context from which the declaration is derived.} 229 Privacy is indicated by the name of a declaration - hence privacy and naming are not orthogonal. This has the advantage that both humans and machines can recogn ize access to private declarations at the point of use without knowledge of the context from which the declaration is derived.}
229 230
230 \subsection{Concurrency} 231 \subsection{Concurrency}
231 232
232 Dart code is always single threaded. There is no shared-state concurrency in Dar t. Concurrency is supported via actor-like entities called {\em isolates}. 233 Dart code is always single threaded. There is no shared-state concurrency in Dar t. Concurrency is supported via actor-like entities called {\em isolates}.
233 234
(...skipping 1426 matching lines...) Expand 10 before | Expand all | Expand 10 after
1660 1661
1661 1662
1662 \subsubsection{Inheritance and Overriding} 1663 \subsubsection{Inheritance and Overriding}
1663 \label{interfaceInheritanceAndOverriding} 1664 \label{interfaceInheritanceAndOverriding}
1664 1665
1665 Let $J$ be an interface and $K$ be a library. We define $inherited(J, K)$ to be the set of members $m$ such that all of the following hold: 1666 Let $J$ be an interface and $K$ be a library. We define $inherited(J, K)$ to be the set of members $m$ such that all of the following hold:
1666 \begin{itemize} 1667 \begin{itemize}
1667 \item $m$ is accessible to $K$ and 1668 \item $m$ is accessible to $K$ and
1668 \item $A$ is a direct superinterface of $J$ and either 1669 \item $A$ is a direct superinterface of $J$ and either
1669 \begin{itemize} 1670 \begin{itemize}
1670 \item $m$ is a member of $A$ or 1671 \item $A$ declares a member $m$ or
1671 \item $m$ is a member of $inherited(A, K)$. 1672 \item $m$ is a member of $inherited(A, K)$.
1672 \end{itemize} 1673 \end{itemize}
1673 \item $m$ is not overridden by $J$. 1674 \item $m$ is not overridden by $J$.
1674 \end{itemize} 1675 \end{itemize}
1675 1676
1676 Furthermore, we define $overrides(J, K)$ to be the set of members $m^\prime$ su ch that all of the following hold: 1677 Furthermore, we define $overrides(J, K)$ to be the set of members $m^\prime$ su ch that all of the following hold:
1677 \begin{itemize} 1678 \begin{itemize}
1678 \item $J$ is the implicit interface of a class $C$. 1679 \item $J$ is the implicit interface of a class $C$.
1679 \item $C$ declares a member $m$. 1680 \item $C$ declares a member $m$.
1680 \item $m^\prime$ has the same name as $m$. 1681 \item $m^\prime$ has the same name as $m$.
1681 \item $m^\prime$ is accessible to $K$. 1682 \item $m^\prime$ is accessible to $K$.
1682 \item $A$ is a direct superinterface of $J$ and either 1683 \item $A$ is a direct superinterface of $J$ and either
1683 \begin{itemize} 1684 \begin{itemize}
1684 \item $m^\prime$ is a member of $A$ or 1685 \item $A$ declares a member $m^\prime$ or
1685 \item $m^\prime$ is a member of $inherited(A, K)$. 1686 \item $m^\prime$ is a member of $inherited(A, K)$.
1686 \end{itemize} 1687 \end{itemize}
1687 \end{itemize} 1688 \end{itemize}
1688 1689
1689 1690
1690 Let $I$ be the implicit interface of a class $C$ declared in library $L$. $I$ { \em inherits} all members of $inherited(I, L)$ and $I$ {\em overrides} $m^\prime $ if $m^\prime \in overrides(I, L)$. 1691 Let $I$ be the implicit interface of a class $C$ declared in library $L$. $I$ { \em inherits} all members of $inherited(I, L)$ and $I$ {\em overrides} $m^\prime $ if $m^\prime \in overrides(I, L)$.
1691 1692
1692 All the static warnings pertaining to the overriding of instance members given i n section \ref{classes} above hold for overriding between interfaces as well. 1693 All the static warnings pertaining to the overriding of instance members given i n section \ref{classes} above hold for overriding between interfaces as well.
1693 1694
1694 It is a static warning if $m$ is a method and $m^\prime$ is a getter, or if $m$ is a getter and $m^\prime$ is a method. 1695 It is a static warning if $m$ is a method and $m^\prime$ is a getter, or if $m$ is a getter and $m^\prime$ is a method.
(...skipping 3130 matching lines...) Expand 10 before | Expand all | Expand 10 after
4825 4826
4826 %\end{dartCode} 4827 %\end{dartCode}
4827 4828
4828 %\rationale{therefore, we opt for the second option. Alternately, one could insi st that assert be a reserved word, which may have an undesirable effect with res pect to compatibility of Javascript code ported to Dart.} 4829 %\rationale{therefore, we opt for the second option. Alternately, one could insi st that assert be a reserved word, which may have an undesirable effect with res pect to compatibility of Javascript code ported to Dart.}
4829 4830
4830 \section{Libraries and Scripts} 4831 \section{Libraries and Scripts}
4831 \label{librariesAndScripts} 4832 \label{librariesAndScripts}
4832 4833
4833 A Dart program consists of one or more libraries, and may be built out of one or more {\em compilation units}. A compilation unit may be a library or a part (\r ef{parts}). 4834 A Dart program consists of one or more libraries, and may be built out of one or more {\em compilation units}. A compilation unit may be a library or a part (\r ef{parts}).
4834 4835
4835 A library consists of (a possibly empty) set of imports, a set of exports, and a set of top-level declarations. A top-level declaration is either a class (\ref{ classes}), a type alias declaration (\ref{typedef}), a function (\ref{functions} ) or a variable declaration (\ref{variables}). The members of a library $L$ are those top level declarations given within a $L$. 4836 A library consists of (a possibly empty) set of imports, a set of exports, and a set of top-level declarations. A top-level declaration is either a class (\ref {classes}), a type alias declaration (\ref{typedef}), a function (\ref{functions }) or a variable declaration (\ref{variables}). The members of a library $L$ are those top level declarations given within a $L$.
4836 4837
4837 \begin{grammar} 4838 \begin{grammar}
4838 {\bf topLevelDefinition:}classDefinition; 4839 {\bf topLevelDefinition:}classDefinition;
4839 % classDefinitionOrInterfaceInjection; 4840 % classDefinitionOrInterfaceInjection;
4840 % interfaceDefinitionOrInterfaceInjection; 4841 % interfaceDefinitionOrInterfaceInjection;
4841 % mixinApplication; 4842 % mixinApplication;
4842 typeAlias; 4843 typeAlias;
4843 \EXTERNAL{}? functionSignature `{\escapegrammar ;}'; 4844 \EXTERNAL{}? functionSignature `{\escapegrammar ;}';
4844 \EXTERNAL{}? getterSignature `{\escapegrammar ;}'; 4845 \EXTERNAL{}? getterSignature `{\escapegrammar ;}';
4845 \EXTERNAL{}? setterSignature `{\escapegrammar ;}'; 4846 \EXTERNAL{}? setterSignature `{\escapegrammar ;}';
(...skipping 984 matching lines...) Expand 10 before | Expand all | Expand 10 after
5830 \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. 5831 \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.
5831 \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 5832 \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
5832 \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. 5833 \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.
5833 \item The names of type variables are short (preferably single letter). Examples : T, S, K, V , E. 5834 \item The names of type variables are short (preferably single letter). Examples : T, S, K, V , E.
5834 \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. 5835 \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.
5835 \end{itemize} 5836 \end{itemize}
5836 } 5837 }
5837 5838
5838 5839
5839 \end{document} 5840 \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