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

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

Issue 639953003: Fix typos due to TeXShop quote (mis)processing (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 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 | 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.6}} 8 {\large Version 1.6}}
9 %\author{The Dart Team} 9 %\author{The Dart Team}
10 \begin{document} 10 \begin{document}
(...skipping 2544 matching lines...) Expand 10 before | Expand all | Expand 10 after
2555 \subsection{Symbols} 2555 \subsection{Symbols}
2556 \label{symbols} 2556 \label{symbols}
2557 2557
2558 A {\em symbol literal} denotes the name of a declaration in a Dart program. 2558 A {\em symbol literal} denotes the name of a declaration in a Dart program.
2559 2559
2560 \begin{grammar} 2560 \begin{grammar}
2561 {\bf symbolLiteral:} 2561 {\bf symbolLiteral:}
2562 `\#' (operator $|$ (identifier (`{\escapegrammar .}' identifier)*)) . 2562 `\#' (operator $|$ (identifier (`{\escapegrammar .}' identifier)*)) .
2563 \end{grammar} 2563 \end{grammar}
2564 2564
2565 A symbol literal \code{\#id} where \code{id} does not begin with an underscore ( Ô\code{\_}Õ) is equivalent to the expression \code{\CONST{} Symbol(ÔidÕ)}. 2565 A symbol literal \code{\#id} where \code{id} does not begin with an underscore ( '\code{\_}') is equivalent to the expression \code{\CONST{} Symbol('id')}.
2566 2566
2567 A symbol literal \code{\#\_id} evaluates to the object that would be returned by the call \code{mirror.getPrivateSymbol(ÔidÕ)} where mirror is an instance of th e class \code{LibraryMirror} defined in the library \code{dart:mirrors}, reflect ing the current library. 2567 A symbol literal \code{\#\_id} evaluates to the object that would be returned by the call \code{mirror.getPrivateSymbol('id')} where mirror is an instance of th e class \code{LibraryMirror} defined in the library \code{dart:mirrors}, reflect ing the current library.
2568 2568
2569 \rationale{ 2569 \rationale{
2570 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. 2570 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.
2571 2571
2572 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 truing would fail. Therefore, Dart reflec tion uses objects of type \code{Symbol} rather than strings. Instances of \code {Symbol} are guaranteed to be stable with repeat to minification. Providing a li teral form for symbols makes reflective code easier to read and write. The fact that symbols are easy to type and can often act as convenient substitutes for en ums are secondary benefits. 2572 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 truing would fail. Therefore, Dart reflec tion uses objects of type \code{Symbol} rather than strings. Instances of \code {Symbol} are guaranteed to be stable with repeat to minification. Providing a li teral form for symbols makes reflective code easier to read and write. The fact that symbols are easy to type and can often act as convenient substitutes for en ums are secondary benefits.
2573 } 2573 }
2574 2574
2575 The static type of a symbol literal is \code{Symbol}. 2575 The static type of a symbol literal is \code{Symbol}.
2576 2576
2577 \subsection{Lists} 2577 \subsection{Lists}
(...skipping 2882 matching lines...) Expand 10 before | Expand all | Expand 10 after
5460 An immediate import directive $I$ may optionally include a prefix clause of the form \AS{} \code{Id} used to prefix names imported by $I$. A deferred import mus t include a prefix clause or a compile time error occurs. It is a compile-time e rror if a prefix used in a deferred import is used in another import clause. 5460 An immediate import directive $I$ may optionally include a prefix clause of the form \AS{} \code{Id} used to prefix names imported by $I$. A deferred import mus t include a prefix clause or a compile time error occurs. It is a compile-time e rror if a prefix used in a deferred import is used in another import clause.
5461 5461
5462 An import directive $I$ may optionally include a namespace combinator clauses us ed to restrict the set of names imported by $I$. Currently, two namespace combin ators are supported: \HIDE{} and \SHOW{}. 5462 An import directive $I$ may optionally include a namespace combinator clauses us ed to restrict the set of names imported by $I$. Currently, two namespace combin ators are supported: \HIDE{} and \SHOW{}.
5463 5463
5464 Let $I$ be an import directive that refers to a URI via the string $s_1$. Evalua tion of $I$ proceeds as follows: 5464 Let $I$ be an import directive that refers to a URI via the string $s_1$. Evalua tion of $I$ proceeds as follows:
5465 5465
5466 If $I$ is a deferred import, no evaluation takes place. Instead, an mapping the name of the prefix, $p$ to a {\em deferred prefix object} is added to the scope of $L$. 5466 If $I$ is a deferred import, no evaluation takes place. Instead, an mapping the name of the prefix, $p$ to a {\em deferred prefix object} is added to the scope of $L$.
5467 The deferred prefix object has the following methods: 5467 The deferred prefix object has the following methods:
5468 5468
5469 \begin{itemize} 5469 \begin{itemize}
5470 \item \code{loadLibrary}. This method returns a future $f$. When called, the met hod causes an immediate import $$ to be executed at some future time, where $I Õ$ is is derived from $I$ by eliding the word \DEFERRED{} and adding a \HIDE{} \ code{loadLibrary} combinator clause. When $$ executes without error, $f$ comp letes successfully. If $$ executes without error, we say that the call to \cod e{loadLibrary} has succeeded, otherwise we say the call has failed. 5470 \item \code{loadLibrary}. This method returns a future $f$. When called, the met hod causes an immediate import $I'$ to be executed at some future time, where $I '$ is is derived from $I$ by eliding the word \DEFERRED{} and adding a \HIDE{} \ code{loadLibrary} combinator clause. When $I'$ executes without error, $f$ comp letes successfully. If $I'$ executes without error, we say that the call to \cod e{loadLibrary} has succeeded, otherwise we say the call has failed.
5471 \item For every top level function $f$ named $id$ in $L$, a corresponding metho d named $id$ with the same signature as $f$. Calling the method results in a run time error. 5471 \item For every top level function $f$ named $id$ in $L$, a corresponding metho d named $id$ with the same signature as $f$. Calling the method results in a run time error.
5472 \item For every top level getter $g$ named $id$ in $L$, a corresponding getter n amed $id$ with the same signature as $g$. Calling the method results in a runti me error. 5472 \item For every top level getter $g$ named $id$ in $L$, a corresponding getter n amed $id$ with the same signature as $g$. Calling the method results in a runti me error.
5473 \item For every top level setter $s$ named $id$ in $L$, a corresponding setter n amed $id$ with the same signature as $s$. Calling the method results in a runti me error. 5473 \item For every top level setter $s$ named $id$ in $L$, a corresponding setter n amed $id$ with the same signature as $s$. Calling the method results in a runti me error.
5474 \item For every type $T$ named $id$ in $L$, a corresponding getter named $id$ wi th return type \code{Type}. Calling the method results in a runtime error. 5474 \item For every type $T$ named $id$ in $L$, a corresponding getter named $id$ wi th return type \code{Type}. Calling the method results in a runtime error.
5475 \end{itemize} 5475 \end{itemize}
5476 5476
5477 After a call succeeds, the name $p$ is mapped to a non-deferred prefix object as described below. In addition, the prefix object also supports the \code{loadLib rary} method, and so it is possible to call \code{loadLibrary} again. If a call fails, nothing happens, and one again has the option to call \code{loadLibrary} again. Whether a repeated call to \code{loadLibrary} succeeds will vary as descr ibed below. 5477 After a call succeeds, the name $p$ is mapped to a non-deferred prefix object as described below. In addition, the prefix object also supports the \code{loadLib rary} method, and so it is possible to call \code{loadLibrary} again. If a call fails, nothing happens, and one again has the option to call \code{loadLibrary} again. Whether a repeated call to \code{loadLibrary} succeeds will vary as descr ibed below.
5478 5478
5479 The effect of a repeated call to \code{$p$.loadLibrary} is as follows: 5479 The effect of a repeated call to \code{$p$.loadLibrary} is as follows:
5480 \begin{itemize} 5480 \begin{itemize}
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
5553 A {\em system library} is a library that is part of the Dart implementation. Any other library is a {\em non-system library}. If a name $N$ is referenced by a l ibrary $L$ and $N$ would be introduced into the top level scope of $L$ by 5553 A {\em system library} is a library that is part of the Dart implementation. Any other library is a {\em non-system library}. If a name $N$ is referenced by a l ibrary $L$ and $N$ would be introduced into the top level scope of $L$ by
5554 imports of two libraries, $L_1$ and $L_2$, and the exported namespace of $L_1$ b inds $N$ to a declaration originating in a system library: 5554 imports of two libraries, $L_1$ and $L_2$, and the exported namespace of $L_1$ b inds $N$ to a declaration originating in a system library:
5555 5555
5556 %an import of a system library and an import of a non-system library: 5556 %an import of a system library and an import of a non-system library:
5557 \begin{itemize} 5557 \begin{itemize}
5558 \item The import of $L_1$ is implicitly extended by a \code{\HIDE{} $N$} clause. 5558 \item The import of $L_1$ is implicitly extended by a \code{\HIDE{} $N$} clause.
5559 \item A static warning is issued. 5559 \item A static warning is issued.
5560 \end{itemize} 5560 \end{itemize}
5561 5561
5562 \rationale { 5562 \rationale {
5563 Whereas normal conflicts are resolved at deployment time, the functionality of \ code{dart:} libraries is injected into an application at run time, and may vary over time as browsers are upgraded. Thus, conflicts with \code{dart:} libraries can arise at runtime, outside the developerÕs control. To avoid breaking deploy ed applications in this way, conflicts with the \code{dart:} libraries are treat ed specially. 5563 Whereas normal conflicts are resolved at deployment time, the functionality of \ code{dart:} libraries is injected into an application at run time, and may vary over time as browsers are upgraded. Thus, conflicts with \code{dart:} libraries can arise at runtime, outside the developer's control. To avoid breaking deploy ed applications in this way, conflicts with the \code{dart:} libraries are treat ed specially.
5564 5564
5565 It is recommended that tools that deploy Dart code produce output in which all i mports use show clauses to ensure that additions to the namespace of a library n ever impact deployed code. 5565 It is recommended that tools that deploy Dart code produce output in which all i mports use show clauses to ensure that additions to the namespace of a library n ever impact deployed code.
5566 } 5566 }
5567 5567
5568 If a name $N$ is referenced by a library $L$ and $N$ is introduced into the to p level scope of $L$ by more than one import, and not all the imports denote the same declaration, then: 5568 If a name $N$ is referenced by a library $L$ and $N$ is introduced into the to p level scope of $L$ by more than one import, and not all the imports denote the same declaration, then:
5569 \begin{itemize} 5569 \begin{itemize}
5570 \item A static warning occurs. 5570 \item A static warning occurs.
5571 \item If $N$ is referenced as a function, getter or setter, a \code{NoSuchMethod Error} is thrown. 5571 \item If $N$ is referenced as a function, getter or setter, a \code{NoSuchMethod Error} is thrown.
5572 \item If $N$ is referenced as a type, it is treated as a malformed type. 5572 \item If $N$ is referenced as a type, it is treated as a malformed type.
5573 5573
(...skipping 854 matching lines...) Expand 10 before | Expand all | Expand 10 after
6428 \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. 6428 \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.
6429 \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 6429 \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
6430 \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. 6430 \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.
6431 \item The names of type variables are short (preferably single letter). Examples : T, S, K, V , E. 6431 \item The names of type variables are short (preferably single letter). Examples : T, S, K, V , E.
6432 \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. 6432 \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.
6433 \end{itemize} 6433 \end{itemize}
6434 } 6434 }
6435 6435
6436 6436
6437 \end{document} 6437 \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