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

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

Issue 1195133002: Added language spelling out static type of prefix objects (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 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 {\large Version 1.10}} 10 {\large Version 1.10}}
(...skipping 6616 matching lines...) Expand 10 before | Expand all | Expand 10 after
6627 \item For every top level getter $g$ named $id$ in $B$, a corresponding getter n amed $id$ with the same signature as $g$. Calling the method results in a runti me error. 6627 \item For every top level getter $g$ named $id$ in $B$, a corresponding getter n amed $id$ with the same signature as $g$. Calling the method results in a runti me error.
6628 \item For every top level setter $s$ named $id$ in $B$, a corresponding setter n amed $id$ with the same signature as $s$. Calling the method results in a runti me error. 6628 \item For every top level setter $s$ named $id$ in $B$, a corresponding setter n amed $id$ with the same signature as $s$. Calling the method results in a runti me error.
6629 \item For every type $T$ named $id$ in $B$, a corresponding getter named $id$ wi th return type \code{Type}. Calling the method results in a runtime error. 6629 \item For every type $T$ named $id$ in $B$, a corresponding getter named $id$ wi th return type \code{Type}. Calling the method results in a runtime error.
6630 \end{itemize} 6630 \end{itemize}
6631 6631
6632 \rationale { 6632 \rationale {
6633 The purpose of adding members of $B$ to $p$ is to ensure that any warnings issu ed when using $p$ are correct, and no spurious warnings are generated. In fact, at runtime we cannot add these members until $B$ is loaded; but any such invoca tions will fail at runtime as specified by virtue of being completely absent. 6633 The purpose of adding members of $B$ to $p$ is to ensure that any warnings issu ed when using $p$ are correct, and no spurious warnings are generated. In fact, at runtime we cannot add these members until $B$ is loaded; but any such invoca tions will fail at runtime as specified by virtue of being completely absent.
6634 } 6634 }
6635 %But this is still a lie detectable by reflection. Probably revise so the type o f p has these members but p does not. 6635 %But this is still a lie detectable by reflection. Probably revise so the type o f p has these members but p does not.
6636 6636
6637 The static type of the prefix object $p$ is a unique interface type that has tho se members whose names and signatures are listed above.
6638
6637 \LMHash{} 6639 \LMHash{}
6638 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. 6640 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.
6639 6641
6640 \LMHash{} 6642 \LMHash{}
6641 The effect of a repeated call to \code{$p$.loadLibrary} is as follows: 6643 The effect of a repeated call to \code{$p$.loadLibrary} is as follows:
6642 \begin{itemize} 6644 \begin{itemize}
6643 \item 6645 \item
6644 If another call to \code{$p$.loadLibrary} has already succeeded, the repeated ca ll also succeeds. 6646 If another call to \code{$p$.loadLibrary} has already succeeded, the repeated ca ll also succeeds.
6645 Otherwise, 6647 Otherwise,
6646 \item 6648 \item
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
6680 then let $NS_i = \SHOW{}([id_1, \ldots, id_k], NS_{i-1}$) 6682 then let $NS_i = \SHOW{}([id_1, \ldots, id_k], NS_{i-1}$)
6681 6683
6682 where $show(l,n)$ takes a list of identifiers $l$ and a namespace $n$, and produ ces a namespace that maps each name in $l$ to the same element that $n$ does. Fu rthermore, for each name $x$ in $l$, if $n$ defines the name $x=$ then the new namespace maps $x=$ to the same element that $n$ does. Otherwise the resulting m apping is undefined. 6684 where $show(l,n)$ takes a list of identifiers $l$ and a namespace $n$, and produ ces a namespace that maps each name in $l$ to the same element that $n$ does. Fu rthermore, for each name $x$ in $l$, if $n$ defines the name $x=$ then the new namespace maps $x=$ to the same element that $n$ does. Otherwise the resulting m apping is undefined.
6683 6685
6684 \item If $C_i$ is of the form 6686 \item If $C_i$ is of the form
6685 6687
6686 \code{\HIDE{} $id_1, \ldots, id_k$} 6688 \code{\HIDE{} $id_1, \ldots, id_k$}
6687 6689
6688 then let $NS_i = \HIDE{}([id_1, \ldots, id_k], NS_{i-1}$) 6690 then let $NS_i = \HIDE{}([id_1, \ldots, id_k], NS_{i-1}$)
6689 6691
6690 where $hide(l, n)$ takes a list of identfiers $l$ and a namespace $n$, and produ ces a namespace that is identical to $n$ except that for each name $k$ in $l$, $ k$ and $k=$ are undefined. 6692 where $hide(l, n)$ takes a list of identifiers $l$ and a namespace $n$, and prod uces a namespace that is identical to $n$ except that for each name $k$ in $l$, $k$ and $k=$ are undefined.
6691 \end{itemize} 6693 \end{itemize}
6692 6694
6693 \LMHash{} 6695 \LMHash{}
6694 Next, if $I$ includes a prefix clause of the form \AS{} $p$, let $NS = NS_n \cu p \{p: prefixObject(NS_n)\}$ where $prefixObject(NS_n)$ is a {\em prefix object} for the namespace $NS_n$, which is an object that has the following members: 6696 Next, if $I$ includes a prefix clause of the form \AS{} $p$, let $NS = NS_n \cu p \{p: prefixObject(NS_n)\}$ where $prefixObject(NS_n)$ is a {\em prefix object} for the namespace $NS_n$, which is an object that has the following members:
6695 6697
6696 \begin{itemize} 6698 \begin{itemize}
6697 \item For every top level function $f$ named $id$ in $NS_n$, a corresponding me thod with the same name and signature as $f$ that forwards (\ref{functionDeclar ations}) to $f$. 6699 \item For every top level function $f$ named $id$ in $NS_n$, a corresponding me thod with the same name and signature as $f$ that forwards (\ref{functionDeclar ations}) to $f$.
6698 \item For every top level getter with the same name and signature as $g$ named $id$ in $NS_n$, a corresponding getter that forwards to $g$. 6700 \item For every top level getter with the same name and signature as $g$ named $id$ in $NS_n$, a corresponding getter that forwards to $g$.
6699 \item For every top level setter $s$ with the same name and signature as named $id$ in $NS_n$, a corresponding setter that forwards to $s$. 6701 \item For every top level setter $s$ with the same name and signature as named $id$ in $NS_n$, a corresponding setter that forwards to $s$.
6700 \item For every type $T$ named $id$ in $NS_n$, a corresponding getter named $id$ with return type \code{Type}, that, when invoked, returns the type object for $ T$. 6702 \item For every type $T$ named $id$ in $NS_n$, a corresponding getter named $id$ with return type \code{Type}, that, when invoked, returns the type object for $ T$.
6701 \end{itemize} 6703 \end{itemize}
6702 6704
6703 \LMHash{} 6705 \LMHash{}
6704 Otherwise, let $NS = NS_n$. 6706 Otherwise, let $NS = NS_n$.
6705 It is a compile-time error if the current library declares a top-level member na med $p$. 6707 It is a compile-time error if the current library declares a top-level member na med $p$.
6706 6708
6709 The static type of the prefix object $p$ is a unique interface type that has tho se members whose names and signatures are listed above.
6710 % What is the static type of a prefix object. Need to state that is a(n anonymou s) type that has members with the same names as signatures as above.
6711
6707 % This is problematic, because it implies that p.T would be available even in a scope that declared p. We really need to think of p as a single object with prop erties p.T etc., except it isn't really that 6712 % This is problematic, because it implies that p.T would be available even in a scope that declared p. We really need to think of p as a single object with prop erties p.T etc., except it isn't really that
6708 % either. After all, p isn't actually available as a stand alone name. 6713 % either. After all, p isn't actually available as a stand alone name.
6709 6714
6710 \LMHash{} 6715 \LMHash{}
6711 Then, for each entry mapping key $k$ to declaration $d$ in $NS$, $d$ is made av ailable in the top level scope of $L$ under the name $k$ unless either: 6716 Then, for each entry mapping key $k$ to declaration $d$ in $NS$, $d$ is made av ailable in the top level scope of $L$ under the name $k$ unless either:
6712 \begin{itemize} 6717 \begin{itemize}
6713 \item 6718 \item
6714 a top-level declaration with the name $k$ exists in $L$, OR 6719 a top-level declaration with the name $k$ exists in $L$, OR
6715 \item a prefix clause of the form \AS{} $k$ is used in $L$. 6720 \item a prefix clause of the form \AS{} $k$ is used in $L$.
6716 \end{itemize} 6721 \end{itemize}
(...skipping 1119 matching lines...) Expand 10 before | Expand all | Expand 10 after
7836 7841
7837 The invariant that each normative paragraph is associated with a line 7842 The invariant that each normative paragraph is associated with a line
7838 containing the text \LMHash{} should be maintained. Extra occurrences 7843 containing the text \LMHash{} should be maintained. Extra occurrences
7839 of \LMHash{} can be added if needed, e.g., in order to make 7844 of \LMHash{} can be added if needed, e.g., in order to make
7840 individual \item{}s in itemized lists addressable. Each \LM.. command 7845 individual \item{}s in itemized lists addressable. Each \LM.. command
7841 must occur on a separate line. \LMHash{} must occur immediately 7846 must occur on a separate line. \LMHash{} must occur immediately
7842 before the associated paragraph, and \LMLabel must occur immediately 7847 before the associated paragraph, and \LMLabel must occur immediately
7843 after the associated \section{}, \subsection{} etc. 7848 after the associated \section{}, \subsection{} etc.
7844 7849
7845 ---------------------------------------------------------------------- 7850 ----------------------------------------------------------------------
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