OLD | NEW |
---|---|
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.3}} | 8 {\large Version 1.3}} |
9 %\author{The Dart Team} | 9 %\author{The Dart Team} |
10 \begin{document} | 10 \begin{document} |
(...skipping 1890 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1901 sort(List$<$T$>$ l) {... l[n] $<$ l[n+1] ...} | 1901 sort(List$<$T$>$ l) {... l[n] $<$ l[n+1] ...} |
1902 \} | 1902 \} |
1903 | 1903 |
1904 \end{dartCode} | 1904 \end{dartCode} |
1905 | 1905 |
1906 \commentary{ | 1906 \commentary{ |
1907 Even where type parameters are in scope there are numerous restrictions at this time: | 1907 Even where type parameters are in scope there are numerous restrictions at this time: |
1908 \begin{itemize} | 1908 \begin{itemize} |
1909 \item A type parameter cannot be used to name a constructor in an instance creat ion expression (\ref{instanceCreation}). | 1909 \item A type parameter cannot be used to name a constructor in an instance creat ion expression (\ref{instanceCreation}). |
1910 \item A type parameter cannot be used as a superclass or superinterface (\ref{su perclasses}, \ref{superinterfaces}, \ref{interfaceSuperinterfaces}). | 1910 \item A type parameter cannot be used as a superclass or superinterface (\ref{su perclasses}, \ref{superinterfaces}, \ref{interfaceSuperinterfaces}). |
1911 \item A type parameter cannot be used as a generic. | 1911 \item A type parameter cannot be used as a generic type. |
1912 \end{itemize} | 1912 \end{itemize} |
1913 | 1913 |
1914 The normative versions of these are given in the appropriate sections of this s pecification. Some of these restrictions may be lifted in the future. | 1914 The normative versions of these are given in the appropriate sections of this s pecification. Some of these restrictions may be lifted in the future. |
1915 } | 1915 } |
1916 | 1916 |
1917 | |
1918 | |
1917 %A generic has a type parameter scope. The enclosing scope of a type parameter s cope of a generic G is the enclosing scope of G. | 1919 %A generic has a type parameter scope. The enclosing scope of a type parameter s cope of a generic G is the enclosing scope of G. |
1918 | 1920 |
1919 | 1921 |
1920 %class T {...} | 1922 %class T {...} |
1921 | 1923 |
1922 %class G<T> extends T; | 1924 %class G<T> extends T; |
1923 | 1925 |
1924 %By current rules, this is illegal. Make sure we preserve this. | 1926 %By current rules, this is illegal. Make sure we preserve this. |
1925 | 1927 |
1926 | 1928 |
(...skipping 3097 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5024 | 5026 |
5025 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: | 5027 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: |
5026 \begin{itemize} | 5028 \begin{itemize} |
5027 \item | 5029 \item |
5028 a top-level declaration with the name $k$ exists in $L$, OR | 5030 a top-level declaration with the name $k$ exists in $L$, OR |
5029 \item a prefix clause of the form \AS{} $k$ is used in $L$. | 5031 \item a prefix clause of the form \AS{} $k$ is used in $L$. |
5030 \end{itemize} | 5032 \end{itemize} |
5031 | 5033 |
5032 \rationale{The greatly increases the chance that a member can be added to a libr ary without breaking its importers.} | 5034 \rationale{The greatly increases the chance that a member can be added to a libr ary without breaking its importers.} |
5033 | 5035 |
5034 If a name $N$ is referenced by a library $L$ and $N$ would be introduced into th e top level scope of $L$ by an import from a library whose URI begins with \code {dart:} and an import from a library whose URI does not begin with \code{dart:}: | 5036 A {\em system library} is a library whose URI begins with \code{dart:}. Any othe r library is a {\em non-system library}. If a name $N$ is referenced by a librar y $L$ and $N$ would be introduced into the top level scope of $L$ by |
Johnni Winther
2014/03/25 07:21:11
I don't think "whose URI" is clearly defined. It p
gbracha
2014/03/25 18:16:10
I've reorganized this so it is cleaner and somewh
| |
5037 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: | |
5038 | |
5039 %an import of a system library and an import of a non-system library: | |
5035 \begin{itemize} | 5040 \begin{itemize} |
5036 \item The import from \code{dart:} is implicitly extended by a \code{\HIDE{} $N$ } clause. | 5041 \item The import of $L_1$ is implicitly extended by a \code{\HIDE{} $N$} clause. |
5037 \item A static warning is issued. | 5042 \item A static warning is issued. |
5038 \end{itemize} | 5043 \end{itemize} |
5039 | 5044 |
5040 \rationale { | 5045 \rationale { |
5041 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. | 5046 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. |
5042 | 5047 |
5043 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. | 5048 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. |
5044 } | 5049 } |
5045 | 5050 |
5046 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: | 5051 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: |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5126 | 5131 |
5127 $NS_i = \SHOW{}([id_1, \ldots, id_k], NS_{i-1}$). | 5132 $NS_i = \SHOW{}([id_1, \ldots, id_k], NS_{i-1}$). |
5128 \item If $C_i$ is of the form \code{\HIDE{} $id_1, \ldots, id_k$} | 5133 \item If $C_i$ is of the form \code{\HIDE{} $id_1, \ldots, id_k$} |
5129 | 5134 |
5130 then let $NS_i = \HIDE{}([id_1, \ldots, id_k], NS_{i-1}$). | 5135 then let $NS_i = \HIDE{}([id_1, \ldots, id_k], NS_{i-1}$). |
5131 \end{itemize} | 5136 \end{itemize} |
5132 | 5137 |
5133 For each | 5138 For each |
5134 entry mapping key $k$ to declaration $d$ in $NS_n$ an entry mapping $k$ to $d$ i s added to the exported namespace of $L$ unless a top-level declaration with th e name $k$ exists in $L$. | 5139 entry mapping key $k$ to declaration $d$ in $NS_n$ an entry mapping $k$ to $d$ i s added to the exported namespace of $L$ unless a top-level declaration with th e name $k$ exists in $L$. |
5135 | 5140 |
5136 If a name $N$ is referenced by a library $L$ and $N$ would be introduced into th e exported namespace of $L$ by an export from a library whose URI begins with \c ode{dart:} and an export from a library whose URI does not begin with \code{dart :}: | 5141 If a name $N$ is referenced by a library $L$ and $N$ would be introduced into th e exported namespace of $L$ by exports of two libraries, $L_1$ and $L_2$, and th e sported namespace of $L_1$ binds $N$ to a declaration originating in a system library: |
Johnni Winther
2014/03/25 07:21:11
'sported' -> 'exported'.
gbracha
2014/03/25 18:16:10
fixed
| |
5142 %an export of a system library and an export of a non-system library: | |
5137 \begin{itemize} | 5143 \begin{itemize} |
5138 \item The export from \code{dart:} is implicitly extended by a \code{\HIDE{} $N$ } clause. | 5144 \item The export of $L_1$ is implicitly extended by a \code{\HIDE{} $N$} clause. |
5139 \item A static warning is issued. | 5145 \item A static warning is issued. |
5140 \end{itemize} | 5146 \end{itemize} |
5141 | 5147 |
5142 \rationale{ | 5148 \rationale{ |
5143 See the discussion in section \ref{imports} for the reasoning behind this rule. | 5149 See the discussion in section \ref{imports} for the reasoning behind this rule. |
5144 } | 5150 } |
5145 | 5151 |
5146 We say that $L$ {\em re-exports library } $B$, and also that $L$ {\em re-exports namespace } $NS_n$. When no confusion can arise, we may simply state that $L$ { \em re-exports }$B$, or that $L$ {\em re-exports }$NS_n$. | 5152 We say that $L$ {\em re-exports library } $B$, and also that $L$ {\em re-exports namespace } $NS_n$. When no confusion can arise, we may simply state that $L$ { \em re-exports }$B$, or that $L$ {\em re-exports }$NS_n$. |
5147 | 5153 |
5148 It is a compile-time error if a name $N$ is re-exported by a library $L$ and $N$ is introduced into the export namespace of $L$ by more than one export, unless all exports refer to same declaration for the name $N$. It is a static warnin g to export two different libraries with the same name. | 5154 It is a compile-time error if a name $N$ is re-exported by a library $L$ and $N$ is introduced into the export namespace of $L$ by more than one export, unless all exports refer to same declaration for the name $N$. It is a static warnin g to export two different libraries with the same name. |
(...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5883 \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. | 5889 \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. |
5884 \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 | 5890 \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 |
5885 \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. | 5891 \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. |
5886 \item The names of type variables are short (preferably single letter). Examples : T, S, K, V , E. | 5892 \item The names of type variables are short (preferably single letter). Examples : T, S, K, V , E. |
5887 \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. | 5893 \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. |
5888 \end{itemize} | 5894 \end{itemize} |
5889 } | 5895 } |
5890 | 5896 |
5891 | 5897 |
5892 \end{document} | 5898 \end{document} |
OLD | NEW |