OLD | NEW |
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.6}} | 10 {\large Version 1.9}} |
11 %\author{The Dart Team} | 11 %\author{The Dart Team} |
12 | 12 |
13 % For information about Location Markers (and in particular the | 13 % For information about Location Markers (and in particular the |
14 % commands \LMHash and \LMLabel), see the long comment at the | 14 % commands \LMHash and \LMLabel), see the long comment at the |
15 % end of this file. | 15 % end of this file. |
16 | 16 |
17 \begin{document} | 17 \begin{document} |
18 \maketitle | 18 \maketitle |
19 \tableofcontents | 19 \tableofcontents |
20 | 20 |
(...skipping 1087 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1108 \LMHash{} | 1108 \LMHash{} |
1109 It is a static warning if an abstract member is declared or inherited in a concr
ete class unless that member overrides a concrete one. | 1109 It is a static warning if an abstract member is declared or inherited in a concr
ete class unless that member overrides a concrete one. |
1110 | 1110 |
1111 \rationale { | 1111 \rationale { |
1112 We wish to warn if one declares a concrete class with abstract members. However,
code like the following should work without warnings: | 1112 We wish to warn if one declares a concrete class with abstract members. However,
code like the following should work without warnings: |
1113 } | 1113 } |
1114 | 1114 |
1115 \begin{dartCode} | 1115 \begin{dartCode} |
1116 class Base \{ | 1116 class Base \{ |
1117 int get one =$>$ 1; | 1117 int get one =$>$ 1; |
1118 \} | 1118 \} |
1119 | 1119 |
1120 abstract class Mix \{ | 1120 abstract class Mix \{ |
1121 int get one; | 1121 int get one; |
1122 int get two =$>$ one + one; | 1122 int get two =$>$ one + one; |
1123 \} | 1123 \} |
1124 | 1124 |
1125 class C extends Base with Mix \{ | 1125 class C extends Base with Mix \{ \} |
1126 \} | |
1127 \} | |
1128 \end{dartCode} | 1126 \end{dartCode} |
1129 | 1127 |
1130 \rationale{At run time, the concrete method \cd{one} declared in \cd{Base} will
be executed, and no problem should arise. Therefore no warning should be issued
and so we suppress warnings if a corresponding concrete member exists in the hie
rarchy. } | 1128 \rationale{At run time, the concrete method \cd{one} declared in \cd{Base} will
be executed, and no problem should arise. Therefore no warning should be issued
and so we suppress warnings if a corresponding concrete member exists in the hie
rarchy. } |
1131 | 1129 |
1132 \subsection{Instance Variables} | 1130 \subsection{Instance Variables} |
1133 \LMLabel{instanceVariables} | 1131 \LMLabel{instanceVariables} |
1134 | 1132 |
1135 \LMHash{} | 1133 \LMHash{} |
1136 Instance variables are variables whose declarations are immediately contained wi
thin a class declaration and that are not declared \STATIC{}. The instance varia
bles of a class $C$ are those instance variables declared by $C$ and the instanc
e variables inherited by $C$ from its superclass. | 1134 Instance variables are variables whose declarations are immediately contained wi
thin a class declaration and that are not declared \STATIC{}. The instance varia
bles of a class $C$ are those instance variables declared by $C$ and the instanc
e variables inherited by $C$ from its superclass. |
1137 | 1135 |
(...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1798 \item \label{optionalPositionals} | 1796 \item \label{optionalPositionals} |
1799 If two members override each other, it is a static warning if the overriding mem
ber has fewer positional parameters than the the overridden one (\ref{instanceM
ethods}). | 1797 If two members override each other, it is a static warning if the overriding mem
ber has fewer positional parameters than the the overridden one (\ref{instanceM
ethods}). |
1800 \item \label{namedParams} | 1798 \item \label{namedParams} |
1801 If two members override each other, it is a static warning if the overriding mem
ber does not have all the named parameters that the the overridden one has (\ref
{instanceMethods}). | 1799 If two members override each other, it is a static warning if the overriding mem
ber does not have all the named parameters that the the overridden one has (\ref
{instanceMethods}). |
1802 \item Setters, getters and operators never have optional parameters of any kind;
it's a compile-time error (\ref{operators}, \ref{getters}, \ref{setters}). | 1800 \item Setters, getters and operators never have optional parameters of any kind;
it's a compile-time error (\ref{operators}, \ref{getters}, \ref{setters}). |
1803 \item It is a compile-time error if a member has the same name as its enclosing
class (\ref{classes}). | 1801 \item It is a compile-time error if a member has the same name as its enclosing
class (\ref{classes}). |
1804 \item A class has an implicit interface (\ref{classes}). | 1802 \item A class has an implicit interface (\ref{classes}). |
1805 \item Superinterface members are not inherited by a class, but are inherited by
its implicit interface. Interfaces have their own inheritance rules (\ref{interf
aceInheritanceAndOverriding}). | 1803 \item Superinterface members are not inherited by a class, but are inherited by
its implicit interface. Interfaces have their own inheritance rules (\ref{interf
aceInheritanceAndOverriding}). |
1806 \item A member is abstract if it has no body and is not labeled \EXTERNAL{} (\re
f{abstractInstanceMembers}, \ref{externalFunctions}). | 1804 \item A member is abstract if it has no body and is not labeled \EXTERNAL{} (\re
f{abstractInstanceMembers}, \ref{externalFunctions}). |
1807 \item A class is abstract iff it is explicitly labeled \ABSTRACT{}.% or if it de
clares (not just inherits) an abstract member (\ref{classes}). | 1805 \item A class is abstract iff it is explicitly labeled \ABSTRACT{}.% or if it de
clares (not just inherits) an abstract member (\ref{classes}). |
1808 \item It is a static warning a concrete class has an abstract member (declared o
r inherited). | 1806 \item It is a static warning if a concrete class has an abstract member (declare
d or inherited). |
1809 \item It is a static warning and a dynamic error to call a non-factory construct
or of an abstract class (\ref{new}). | 1807 \item It is a static warning and a dynamic error to call a non-factory construct
or of an abstract class (\ref{new}). |
1810 \item If a class defines an instance member named $m$, and any of its superinter
faces have a member named $m$, the interface of the class overrides $m$. | 1808 \item If a class defines an instance member named $m$, and any of its superinter
faces have a member named $m$, the interface of the class overrides $m$. |
1811 \item An interface inherits all members of its superinterfaces that are not ov
erridden and not members of multiple superinterfaces. | 1809 \item An interface inherits all members of its superinterfaces that are not ov
erridden and not members of multiple superinterfaces. |
1812 \item If multiple superinterfaces of an interface define a member with the same
name $m$, then at most one member is inherited. That member (if it exists) is t
he one whose type is a subtype of all the others. If there is no such member, th
en: | 1810 \item If multiple superinterfaces of an interface define a member with the same
name $m$, then at most one member is inherited. That member (if it exists) is t
he one whose type is a subtype of all the others. If there is no such member, th
en: |
1813 \begin{itemize} | 1811 \begin{itemize} |
1814 \item A static warning is given. | 1812 \item A static warning is given. |
1815 \item If possible the interface gets a member named $m$ that has the minimum
number of required parameters among all the members in the superinterfaces, the
maximal number of positionals, and the superset of named parameters. The typ
es of these are all \DYNAMIC{}. If this is impossible then no member $m$ appears
in the interface. | 1813 \item If possible the interface gets a member named $m$ that has the minimum
number of required parameters among all the members in the superinterfaces, the
maximal number of positionals, and the superset of named parameters. The typ
es of these are all \DYNAMIC{}. If this is impossible then no member $m$ appears
in the interface. |
1816 \end{itemize} (\ref{interfaceInheritanceAndOverriding}) | 1814 \end{itemize} (\ref{interfaceInheritanceAndOverriding}) |
1817 \item Rule \ref{typeSigAssignable} applies to interfaces as well as classes (\
ref{interfaceInheritanceAndOverriding}). | 1815 \item Rule \ref{typeSigAssignable} applies to interfaces as well as classes (\
ref{interfaceInheritanceAndOverriding}). |
1818 \item It is a static warning if a concrete class does not have an implementatio
n for a method in any of its superinterfaces unless it declares its own \cd{n
oSuchMethod} method (\ref{superinterfaces}). | 1816 \item It is a static warning if a concrete class does not have an implementatio
n for a method in any of its superinterfaces unless it declares its own \cd{n
oSuchMethod} method (\ref{superinterfaces}). |
(...skipping 4562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6381 \LMHash{} | 6379 \LMHash{} |
6382 A {\em part header} begins with \PART{} \OF{} followed by the name of the libr
ary the part belongs to. A part declaration consists of a part header followed
by a sequence of top-level declarations. | 6380 A {\em part header} begins with \PART{} \OF{} followed by the name of the libr
ary the part belongs to. A part declaration consists of a part header followed
by a sequence of top-level declarations. |
6383 | 6381 |
6384 \LMHash{} | 6382 \LMHash{} |
6385 Compiling a part directive of the form \code{\PART{} $s$;} causes the Dart syste
m to attempt to compile the contents of the URI that is the value of $s$. The to
p-level declarations at that URI are then compiled by the Dart compiler in the s
cope of the current library. It is a compile-time error if the contents of the U
RI are not a valid part declaration. It is a static warning if the referenced pa
rt declaration $p$ names a library other than the current library as the library
to which $p$ belongs. | 6383 Compiling a part directive of the form \code{\PART{} $s$;} causes the Dart syste
m to attempt to compile the contents of the URI that is the value of $s$. The to
p-level declarations at that URI are then compiled by the Dart compiler in the s
cope of the current library. It is a compile-time error if the contents of the U
RI are not a valid part declaration. It is a static warning if the referenced pa
rt declaration $p$ names a library other than the current library as the library
to which $p$ belongs. |
6386 | 6384 |
6387 \subsection{Scripts} | 6385 \subsection{Scripts} |
6388 \LMLabel{scripts} | 6386 \LMLabel{scripts} |
6389 | 6387 |
6390 \LMHash{} | 6388 \LMHash{} |
6391 A {\em script} is a library whose exported namespace (\ref{exports}) includes a
top-level function \code{main}. | 6389 A {\em script} is a library whose exported namespace (\ref{exports}) includes a
top-level member named \code{main}. It is a static warning if the static type
of \code{main} is not assignable to a function type or is a function type with m
ore than two required parameters. |
| 6390 |
6392 A script $S$ may be executed as follows: | 6391 A script $S$ may be executed as follows: |
6393 | 6392 |
6394 \LMHash{} | 6393 \LMHash{} |
6395 First, $S$ is compiled as a library as specified above. Then, the top-level func
tion \code{main} that is in the exported namespace of $S$ is invoked. If \code{m
ain} has no positional parameters, it is invoked with no arguments. Otherwise if
\code{main} has exactly one positional parameter, it is invoked with a single a
ctual argument whose runtime type implements \code{List$<$String$>$}. Otherwise
\code{main} is invoked with the following two actual arguments: | 6394 First, $S$ is compiled as a library as specified above. Then, the top-level func
tion \code{main} that is in the exported namespace of $S$ is invoked. If \code{m
ain} has no positional parameters, it is invoked with no arguments. Otherwise if
\code{main} has exactly one positional parameter, it is invoked with a single a
ctual argument whose runtime type implements \code{List$<$String$>$}. Otherwise
\code{main} is invoked with the following two actual arguments: |
6396 \begin{enumerate} | 6395 \begin{enumerate} |
6397 \item An object whose runtime type implements \code{List$<$String$>$}. | 6396 \item An object whose runtime type implements \code{List$<$String$>$}. |
6398 \item The initial message of the current isolate $i$ as determined by the invoca
tion of \code{Isolate.spawnUri} that spawned $i$. | 6397 \item The initial message of the current isolate $i$ as determined by the invoca
tion of \code{Isolate.spawnUri} that spawned $i$. |
6399 \end{enumerate} | 6398 \end{enumerate} |
6400 | 6399 |
6401 \LMHash{} | 6400 \LMHash{} |
6402 It is a run time error if $S$ does not declare or import a top-level function \c
ode{main}. It is a static warning if \code{main} has more than two required para
meters. | 6401 It is a run time error if $S$ does not declare or export either: |
| 6402 \begin{itemize} |
| 6403 \item A top-level function named \code{main}, or |
| 6404 \item A top-level getter named \code{main} that returns a function. |
| 6405 \end{itemize} |
6403 | 6406 |
6404 \commentary { | 6407 \commentary { |
6405 Note that if \code{main} requires more than two arguments, a run time error will
occur. | 6408 Note that if \code{main} requires more than two arguments, a run time error will
occur. |
6406 } | 6409 } |
6407 | 6410 |
6408 \rationale{ | 6411 \rationale{ |
6409 The names of scripts are optional, in the interests of interactive, informal use
. However, any script of long term value should be given a name as a matter of g
ood practice. | 6412 The names of scripts are optional, in the interests of interactive, informal use
. However, any script of long term value should be given a name as a matter of g
ood practice. |
6410 } | 6413 } |
6411 | 6414 |
6412 \commentary { | 6415 \commentary { |
(...skipping 922 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7335 | 7338 |
7336 The invariant that each normative paragraph is associated with a line | 7339 The invariant that each normative paragraph is associated with a line |
7337 containing the text \LMHash{} should be maintained. Extra occurrences | 7340 containing the text \LMHash{} should be maintained. Extra occurrences |
7338 of \LMHash{} can be added if needed, e.g., in order to make | 7341 of \LMHash{} can be added if needed, e.g., in order to make |
7339 individual \item{}s in itemized lists addressable. Each \LM.. command | 7342 individual \item{}s in itemized lists addressable. Each \LM.. command |
7340 must occur on a separate line. \LMHash{} must occur immediately | 7343 must occur on a separate line. \LMHash{} must occur immediately |
7341 before the associated paragraph, and \LMLabel must occur immediately | 7344 before the associated paragraph, and \LMLabel must occur immediately |
7342 after the associated \section{}, \subsection{} etc. | 7345 after the associated \section{}, \subsection{} etc. |
7343 | 7346 |
7344 ---------------------------------------------------------------------- | 7347 ---------------------------------------------------------------------- |
OLD | NEW |