| 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 |
| 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. | 1918 %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 | 1919 |
| 1919 | 1920 |
| 1920 %class T {...} | 1921 %class T {...} |
| 1921 | 1922 |
| 1922 %class G<T> extends T; | 1923 %class G<T> extends T; |
| 1923 | 1924 |
| 1924 %By current rules, this is illegal. Make sure we preserve this. | 1925 %By current rules, this is illegal. Make sure we preserve this. |
| 1925 | 1926 |
| 1926 | 1927 |
| (...skipping 3097 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5024 | 5025 |
| 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: | 5026 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} | 5027 \begin{itemize} |
| 5027 \item | 5028 \item |
| 5028 a top-level declaration with the name $k$ exists in $L$, OR | 5029 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$. | 5030 \item a prefix clause of the form \AS{} $k$ is used in $L$. |
| 5030 \end{itemize} | 5031 \end{itemize} |
| 5031 | 5032 |
| 5032 \rationale{The greatly increases the chance that a member can be added to a libr
ary without breaking its importers.} | 5033 \rationale{The greatly increases the chance that a member can be added to a libr
ary without breaking its importers.} |
| 5033 | 5034 |
| 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:}: | 5035 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 |
| 5036 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: |
| 5037 |
| 5038 %an import of a system library and an import of a non-system library: |
| 5035 \begin{itemize} | 5039 \begin{itemize} |
| 5036 \item The import from \code{dart:} is implicitly extended by a \code{\HIDE{} $N$
} clause. | 5040 \item The import of $L_1$ is implicitly extended by a \code{\HIDE{} $N$} clause. |
| 5037 \item A static warning is issued. | 5041 \item A static warning is issued. |
| 5038 \end{itemize} | 5042 \end{itemize} |
| 5039 | 5043 |
| 5040 \rationale { | 5044 \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. | 5045 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 | 5046 |
| 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. | 5047 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 } | 5048 } |
| 5045 | 5049 |
| 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: | 5050 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 | 5130 |
| 5127 $NS_i = \SHOW{}([id_1, \ldots, id_k], NS_{i-1}$). | 5131 $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$} | 5132 \item If $C_i$ is of the form \code{\HIDE{} $id_1, \ldots, id_k$} |
| 5129 | 5133 |
| 5130 then let $NS_i = \HIDE{}([id_1, \ldots, id_k], NS_{i-1}$). | 5134 then let $NS_i = \HIDE{}([id_1, \ldots, id_k], NS_{i-1}$). |
| 5131 \end{itemize} | 5135 \end{itemize} |
| 5132 | 5136 |
| 5133 For each | 5137 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$. | 5138 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 | 5139 |
| 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
:}: | 5140 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 exported namespace of $L_1$ binds $N$ to a declaration originating in a system
library: |
| 5141 %an export of a system library and an export of a non-system library: |
| 5137 \begin{itemize} | 5142 \begin{itemize} |
| 5138 \item The export from \code{dart:} is implicitly extended by a \code{\HIDE{} $N$
} clause. | 5143 \item The export of $L_1$ is implicitly extended by a \code{\HIDE{} $N$} clause. |
| 5139 \item A static warning is issued. | 5144 \item A static warning is issued. |
| 5140 \end{itemize} | 5145 \end{itemize} |
| 5141 | 5146 |
| 5142 \rationale{ | 5147 \rationale{ |
| 5143 See the discussion in section \ref{imports} for the reasoning behind this rule. | 5148 See the discussion in section \ref{imports} for the reasoning behind this rule. |
| 5144 } | 5149 } |
| 5145 | 5150 |
| 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$. | 5151 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 | 5152 |
| 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. | 5153 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5201 \end{grammar} | 5206 \end{grammar} |
| 5202 | 5207 |
| 5203 It is a compile-time error if the string literal $x$ that describes a URI is no
t a compile-time constant, or if $x$ involves string interpolation. | 5208 It is a compile-time error if the string literal $x$ that describes a URI is no
t a compile-time constant, or if $x$ involves string interpolation. |
| 5204 | 5209 |
| 5205 This specification does not discuss the interpretation of URIs, with the followi
ng exceptions. | 5210 This specification does not discuss the interpretation of URIs, with the followi
ng exceptions. |
| 5206 | 5211 |
| 5207 \rationale{ | 5212 \rationale{ |
| 5208 The interpretation of URIs is mostly left to the surrounding computing environm
ent. For example, if Dart is running in a web browser, that browser will likely
interpret some URIs. While it might seem attractive to specify, say, that URIs a
re interpreted with respect to a standard such as IETF RFC 3986, in practice thi
s will usually depend on the browser and cannot be relied upon. | 5213 The interpretation of URIs is mostly left to the surrounding computing environm
ent. For example, if Dart is running in a web browser, that browser will likely
interpret some URIs. While it might seem attractive to specify, say, that URIs a
re interpreted with respect to a standard such as IETF RFC 3986, in practice thi
s will usually depend on the browser and cannot be relied upon. |
| 5209 } | 5214 } |
| 5210 | 5215 |
| 5211 A URI of the form \code{dart:$s$} is interpreted as a reference to a library $s$
that is part of the Dart implementation. | 5216 A URI of the form \code{dart:$s$} is interpreted as a reference to a system libr
ary (\ref{imports}) $s$. |
| 5212 | 5217 |
| 5213 A URI of the form \code{package:$s$} is interpreted as a URI of the form \code{p
ackages/s} relative to an implementation specified location. | 5218 A URI of the form \code{package:$s$} is interpreted as a URI of the form \code{p
ackages/s} relative to an implementation specified location. |
| 5214 | 5219 |
| 5215 \commentary{ | 5220 \commentary{ |
| 5216 This location will often be the location of the root library presented to the Da
rt compiler. However, implementations may supply means to override or replace th
is choice. | 5221 This location will often be the location of the root library presented to the Da
rt compiler. However, implementations may supply means to override or replace th
is choice. |
| 5217 } | 5222 } |
| 5218 | 5223 |
| 5219 \rationale{ | 5224 \rationale{ |
| 5220 The intent is that, during development, Dart programmers can rely on a package m
anager to find elements of their program. Such package managers may provide a di
rectory structure starting at a local directory \code{packages} where they place
the required dart code (or links thereto). | 5225 The intent is that, during development, Dart programmers can rely on a package m
anager to find elements of their program. Such package managers may provide a di
rectory structure starting at a local directory \code{packages} where they place
the required dart code (or links thereto). |
| 5221 } | 5226 } |
| (...skipping 661 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. | 5888 \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 | 5889 \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. | 5890 \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. | 5891 \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. | 5892 \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} | 5893 \end{itemize} |
| 5889 } | 5894 } |
| 5890 | 5895 |
| 5891 | 5896 |
| 5892 \end{document} | 5897 \end{document} |
| OLD | NEW |