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.6}} | 8 {\large Version 1.6}} |
9 %\author{The Dart Team} | 9 %\author{The Dart Team} |
10 \begin{document} | 10 \begin{document} |
(...skipping 10 matching lines...) Expand all Loading... |
21 \section{Scope} | 21 \section{Scope} |
22 \label{ecmaScope} | 22 \label{ecmaScope} |
23 | 23 |
24 This Ecma standard specifies the syntax and semantics of the Dart programming la
nguage. It does not specify the APIs of the Dart libraries except where those l
ibrary elements are essential to the correct functioning of the language itself
(e.g., the existence of class \cd{Object} with methods such as \cd{noSuchMethod}
, \cd{runtimeType}). | 24 This Ecma standard specifies the syntax and semantics of the Dart programming la
nguage. It does not specify the APIs of the Dart libraries except where those l
ibrary elements are essential to the correct functioning of the language itself
(e.g., the existence of class \cd{Object} with methods such as \cd{noSuchMethod}
, \cd{runtimeType}). |
25 | 25 |
26 \section{Conformance} | 26 \section{Conformance} |
27 \label{ecmaConformance} | 27 \label{ecmaConformance} |
28 | 28 |
29 A conforming implementation of the Dart programming language must provide and s
upport all the APIs (libraries, types, functions, getters, setters, whether top
-level, static, instance or local) mandated in this specification. | 29 A conforming implementation of the Dart programming language must provide and s
upport all the APIs (libraries, types, functions, getters, setters, whether top
-level, static, instance or local) mandated in this specification. |
30 | 30 |
31 A conforming implementation is permitted to provide additional APIs, but not add
itional syntax, except for experimental features in support of enumerated types
and deferred loading which are expected to be added in the next revision of this
specification. | 31 A conforming implementation is permitted to provide additional APIs, but not add
itional syntax. |
32 | 32 |
33 % A claim of conformance with this Ecma Standard shall specify? | 33 % A claim of conformance with this Ecma Standard shall specify? |
34 | 34 |
35 \section{Normative References} | 35 \section{Normative References} |
36 \label{ecmaNormativeReferences} | 36 \label{ecmaNormativeReferences} |
37 | 37 |
38 The following referenced documents are indispensable for the application of this
document. For dated references, only the edition cited applies. For undated ref
erences, the latest edition of the referenced document (including any amendments
) applies. | 38 The following referenced documents are indispensable for the application of this
document. For dated references, only the edition cited applies. For undated ref
erences, the latest edition of the referenced document (including any amendments
) applies. |
39 | 39 |
40 \begin{enumerate} | 40 \begin{enumerate} |
41 \item | 41 \item |
(...skipping 2131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2173 } | 2173 } |
2174 \item A constant constructor invocation (\ref{const}) that is not qualified by a
deferred prefix. | 2174 \item A constant constructor invocation (\ref{const}) that is not qualified by a
deferred prefix. |
2175 \item A constant list literal (\ref{lists}). | 2175 \item A constant list literal (\ref{lists}). |
2176 \item A constant map literal (\ref{maps}). | 2176 \item A constant map literal (\ref{maps}). |
2177 \item A simple or qualified identifier denoting a top-level function (\ref{funct
ions}) or a static method (\ref{staticMethods}) that is not qualified by a defer
red prefix. | 2177 \item A simple or qualified identifier denoting a top-level function (\ref{funct
ions}) or a static method (\ref{staticMethods}) that is not qualified by a defer
red prefix. |
2178 \item A parenthesized expression \code{($e$)} where $e$ is a constant expression
. | 2178 \item A parenthesized expression \code{($e$)} where $e$ is a constant expression
. |
2179 \item An expression of the form \code{identical($e_1$, $e_2$)} where $e_1$ and $
e_2$ are constant expressions and \code{identical()} is statically bound to the
predefined dart function \code{identical()} discussed above (\ref{objectIdent
ity}). | 2179 \item An expression of the form \code{identical($e_1$, $e_2$)} where $e_1$ and $
e_2$ are constant expressions and \code{identical()} is statically bound to the
predefined dart function \code{identical()} discussed above (\ref{objectIdent
ity}). |
2180 \item An expression of one of the forms \code{$e_1$ == $e_2$} or \code{$e_1$ !
= $e_2$} where $e_1$ and $e_2$ are constant expressions that evaluate to a numer
ic, string or boolean value or to \NULL{}. | 2180 \item An expression of one of the forms \code{$e_1$ == $e_2$} or \code{$e_1$ !
= $e_2$} where $e_1$ and $e_2$ are constant expressions that evaluate to a numer
ic, string or boolean value or to \NULL{}. |
2181 \item An expression of one of the forms \code{!$e$}, \code{$e_1$ \&\& $e_2$} or
\code{$e_1 || e_2$}, where $e$, $e_1$ and $e_2$ are constant expressions that e
valuate to a boolean value. | 2181 \item An expression of one of the forms \code{!$e$}, \code{$e_1$ \&\& $e_2$} or
\code{$e_1 || e_2$}, where $e$, $e_1$ and $e_2$ are constant expressions that e
valuate to a boolean value. |
2182 \item An expression of one of the forms \~{}$e$, $e_1$ \^{} $e_2$, \code{$e_1$ \
& $e_2$}, $e_1 | e_2$, $e_1 >> e_2$ or $e_1 << e_2$, where $e$, $e_1$ and $e_2
$ are constant expressions that evaluate to an integer value or to \NULL{}. | 2182 \item An expression of one of the forms \~{}$e$, $e_1$ \^{} $e_2$, \code{$e_1$ \
& $e_2$}, $e_1 | e_2$, $e_1 >> e_2$ or $e_1 << e_2$, where $e$, $e_1$ and $e_2
$ are constant expressions that evaluate to an integer value or to \NULL{}. |
2183 \item An expression of one of the forms \code{$-e$}, \code{$e_1 + e_2$}, \code{
$e_1$ - $e_2$}, \code{$e_1$ * $e_2$}, \code{$e_1$ / $e_2$,} \code{$e_1$ \~{}/ $e
_2$}, \code{$e_1 > e_2$}, \code{$e_1 < e_2$}, \code{$e_1$ $>$= $e_2$}, \cod
e{$e_1$ $<$= $e_2$} or \code{$e_1$ \% $e_2$}, where $e$, $e_1$ and $e_2$ are co
nstant expressions that evaluate to a numeric value or to \NULL{}. | 2183 \item An expression of the form \code{$e_1 + e_2$} where $e_1$ and $e_2$ are con
stant expressions that evaluate to a numeric or string value or to \NULL{}. |
2184 \item An expression of the form \code{$e_1$?$e_2$:$e3$} where where $e_1$, $e_2$
and $e_3$ are constant expressions and $e_1$ evaluates to a boolean value. | 2184 \item An expression of one of the forms \code{$-e$}, \code{$e_1$ - $e_2$}, \code
{$e_1$ * $e_2$}, \code{$e_1$ / $e_2$,} \code{$e_1$ \~{}/ $e_2$}, \code{$e_1 >
e_2$}, \code{$e_1 < e_2$}, \code{$e_1$ $>$= $e_2$}, \code{$e_1$ $<$= $e_2$} o
r \code{$e_1$ \% $e_2$}, where $e$, $e_1$ and $e_2$ are constant expressions th
at evaluate to a numeric value or to \NULL{}. |
| 2185 \item An expression of the form \code{$e_1$?$e_2$:$e3$} where $e_1$, $e_2$ and $
e_3$ are constant expressions and $e_1$ evaluates to a boolean value. |
| 2186 \item An expression of the form \code{$e$.length} where $e$ is a constant expres
sion that evaluates to a string value. |
2185 \end{itemize} | 2187 \end{itemize} |
2186 | 2188 |
2187 % null in all the expressions | 2189 % null in all the expressions |
2188 | 2190 |
2189 % designed so constants do not depend on check diode being on or not. | 2191 % designed so constants do not depend on check diode being on or not. |
2190 | 2192 |
2191 It is a compile-time error if an expression is required to be a constant express
ion but its evaluation would raise an exception. | 2193 It is a compile-time error if an expression is required to be a constant express
ion but its evaluation would raise an exception. |
2192 | 2194 |
2193 % so, checked mode? analyzers? editor/development compilers? | 2195 % so, checked mode? analyzers? editor/development compilers? |
2194 \commentary{ | 2196 \commentary{ |
(...skipping 1838 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4033 An {\em await expression} allows code to yield control until an asynchronous ope
ration (\ref{functions}) completes. | 4035 An {\em await expression} allows code to yield control until an asynchronous ope
ration (\ref{functions}) completes. |
4034 | 4036 |
4035 \begin{grammar} | 4037 \begin{grammar} |
4036 {\bf awaitExpression:} | 4038 {\bf awaitExpression:} |
4037 \AWAIT{} unaryExpression | 4039 \AWAIT{} unaryExpression |
4038 \end{grammar} | 4040 \end{grammar} |
4039 | 4041 |
4040 Evaluation of an await expression $a$ of the form \AWAIT{} $e$ proceeds as follo
ws: | 4042 Evaluation of an await expression $a$ of the form \AWAIT{} $e$ proceeds as follo
ws: |
4041 First, the expression $e$ is evaluated. Next: | 4043 First, the expression $e$ is evaluated. Next: |
4042 | 4044 |
4043 If $e$ evaluates to an instance of \code{Future}, $f$, then execution of the fun
ction $m$ immediately enclosing $a$ is suspended until after $f$ completes. The
stream associated with the innermost enclosing asynchronous for loop (\ref{async
hronousFor-in}), if any, is paused. At some time after $f$ is completed, control
returns to the current invocation. The stream associated with the innermost enc
losing asynchronous for loop (\ref{asynchronousFor-in}), if any, is resumed. If
$f$ has completed with an exception $x$, $a$ raises $x$. If $f$ completes with
a value $v$, $a$ evaluates to $v$. | 4045 If $e$ raises an exception $x$, then an instance $f$ of class \code{Future} is a
llocated and later completed with $x$. Otherwise, if $e$ evaluates to an object
$o$ that is not an instance of \code{Future}, then let $f$ be the result of call
ing \code{Future.value()} with $o$ as its argument; otherwise let $f$ be the res
ult of evaluating $e$. |
4044 | 4046 |
4045 Otherwise, the value of $a$ is the value of $e$. If evaluation of $e$ raises an
exception $x$, $a$ raises $x$. | 4047 Next, execution of the function $m$ immediately enclosing $a$ is suspended unti
l after $f$ completes. The stream associated with the innermost enclosing asynch
ronous for loop (\ref{asynchronousFor-in}), if any, is paused. At some time afte
r $f$ is completed, control returns to the current invocation. The stream associ
ated with the innermost enclosing asynchronous for loop (\ref{asynchronousFor-i
n}), if any, is resumed. If $f$ has completed with an exception $x$, $a$ raises
$x$. If $f$ completes with a value $v$, $a$ evaluates to $v$. |
| 4048 |
| 4049 %Otherwise, the value of $a$ is the value of $e$. If evaluation of $e$ raises an
exception $x$, $a$ raises $x$. |
4046 | 4050 |
4047 \commentary{ | 4051 \commentary{ |
4048 It is a compile-time error if the function immediately enclosing $a$ is not
declared asynchronous. However, this error is simply a syntax error, because in
the context of a normal function, \AWAIT{} has no special meaning. | 4052 It is a compile-time error if the function immediately enclosing $a$ is not
declared asynchronous. However, this error is simply a syntax error, because in
the context of a normal function, \AWAIT{} has no special meaning. |
4049 } | 4053 } |
4050 | 4054 |
4051 \rationale{ | 4055 \rationale{ |
4052 An await expression has no meaning in a synchronous function. If such a function
were to suspend waiting for a future, it would no longer be synchronous. | 4056 An await expression has no meaning in a synchronous function. If such a function
were to suspend waiting for a future, it would no longer be synchronous. |
4053 } | 4057 } |
4054 | 4058 |
4055 \commentary{ | 4059 \commentary{ |
(...skipping 2368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6424 \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. |
6425 \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 |
6426 \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. |
6427 \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. |
6428 \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. |
6429 \end{itemize} | 6433 \end{itemize} |
6430 } | 6434 } |
6431 | 6435 |
6432 | 6436 |
6433 \end{document} | 6437 \end{document} |
OLD | NEW |