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.4}} | 8 {\large Version 1.4}} |
9 %\author{The Dart Team} | 9 %\author{The Dart Team} |
10 \begin{document} | 10 \begin{document} |
(...skipping 2060 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2071 The predefined Dart function \cd{identical()} is defined such that \code{identic
al($c_1$, $c_2$)} iff: | 2071 The predefined Dart function \cd{identical()} is defined such that \code{identic
al($c_1$, $c_2$)} iff: |
2072 \begin{itemize} | 2072 \begin{itemize} |
2073 \item $c_1$ evaluates to either \NULL{} or an instance of \code{bool} and \co
de{$c_1$ == $c_2$}, OR | 2073 \item $c_1$ evaluates to either \NULL{} or an instance of \code{bool} and \co
de{$c_1$ == $c_2$}, OR |
2074 \item $c_1$ and $c_2$ are instances of \code{int} and \code{$c_1$ == $c_2$}, OR | 2074 \item $c_1$ and $c_2$ are instances of \code{int} and \code{$c_1$ == $c_2$}, OR |
2075 \item $c_1$ and $c_2$ are constant strings and \code{$c_1$ == $c_2$}, OR | 2075 \item $c_1$ and $c_2$ are constant strings and \code{$c_1$ == $c_2$}, OR |
2076 \item $c_1$ and $c_2$ are instances of \cd{double} and one of the following
holds: | 2076 \item $c_1$ and $c_2$ are instances of \cd{double} and one of the following
holds: |
2077 \begin{itemize} | 2077 \begin{itemize} |
2078 \item $c_1$ and $c_2$ are non-zero and \code{$c_1$ == $c_2$}. | 2078 \item $c_1$ and $c_2$ are non-zero and \code{$c_1$ == $c_2$}. |
2079 \item Both $c_1$ and $c_2$ are $+0.0$. | 2079 \item Both $c_1$ and $c_2$ are $+0.0$. |
2080 \item Both $c_1$ and $c_2$ are $-0.0$. | 2080 \item Both $c_1$ and $c_2$ are $-0.0$. |
2081 \item Both $c_1$ and $c_2$ represent a NaN value. | 2081 \item Both $c_1$ and $c_2$ represent a NaN value with the same underlying bit
pattern. |
2082 \end{itemize} | 2082 \end{itemize} |
2083 OR | 2083 OR |
2084 \item $c_1$ and $c_2$ are constant lists that are defined to be identical in th
e specification of literal list expressions (\ref{lists}), OR | 2084 \item $c_1$ and $c_2$ are constant lists that are defined to be identical in th
e specification of literal list expressions (\ref{lists}), OR |
2085 \item $c_1$ and $c_2$ are constant maps that are defined to be identical in the
specification of literal map expressions (\ref{maps}), OR | 2085 \item $c_1$ and $c_2$ are constant maps that are defined to be identical in the
specification of literal map expressions (\ref{maps}), OR |
2086 \item $c_1$ and $c_2$ are constant objects of the same class $C$ and each membe
r field of $c_1$ is identical to the corresponding field of $c_2$. OR | 2086 \item $c_1$ and $c_2$ are constant objects of the same class $C$ and each membe
r field of $c_1$ is identical to the corresponding field of $c_2$. OR |
2087 \item $c_1$ and $c_2$ are the same object. | 2087 \item $c_1$ and $c_2$ are the same object. |
2088 \end{itemize} | 2088 \end{itemize} |
2089 | 2089 |
2090 \commentary{ | 2090 \commentary{ |
2091 The definition of \cd{identity} for doubles differs from that of equality in tha
t a NaN is equal to itself, and that negative and positive zero are distinct. | 2091 The definition of \cd{identity} for doubles differs from that of equality in tha
t a NaN is equal to itself, and that negative and positive zero are distinct. |
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2599 . | 2599 . |
2600 \end{grammar} | 2600 \end{grammar} |
2601 | 2601 |
2602 A {\em map literal} consists of zero or more entries. Each entry has a {\em key}
and a {\em value}. Each key and each value is denoted by an expression. | 2602 A {\em map literal} consists of zero or more entries. Each entry has a {\em key}
and a {\em value}. Each key and each value is denoted by an expression. |
2603 | 2603 |
2604 If a map literal begins with the reserved word \CONST{}, it is a {\em constant m
ap literal} which is a compile-time constant (\ref{constants}) and therefore eva
luated at compile-time. Otherwise, it is a {\em run-time map literal} and it is
evaluated at run-time. Only run-time map literals can be mutated | 2604 If a map literal begins with the reserved word \CONST{}, it is a {\em constant m
ap literal} which is a compile-time constant (\ref{constants}) and therefore eva
luated at compile-time. Otherwise, it is a {\em run-time map literal} and it is
evaluated at run-time. Only run-time map literals can be mutated |
2605 after they are created. Attempting to mutate a constant map literal will result
in a dynamic error. | 2605 after they are created. Attempting to mutate a constant map literal will result
in a dynamic error. |
2606 | 2606 |
2607 It is a compile-time error if either a key or a value of an entry in a constant
map literal is not a compile-time constant. It is a compile-time error if the ke
y of an entry in a constant map literal is an instance of a class that implement
s the operator $==$ unless the key is a | 2607 It is a compile-time error if either a key or a value of an entry in a constant
map literal is not a compile-time constant. It is a compile-time error if the ke
y of an entry in a constant map literal is an instance of a class that implement
s the operator $==$ unless the key is a |
2608 %symbol, | 2608 %symbol, |
2609 string, an integer, literal symbol or the result of invoking a constant construc
tor of class \cd{Symbol}. It is a compile-time error if the type arguments of a
constant map literal include a type parameter. | 2609 string, an integer, a literal symbol or the result of invoking a constant constr
uctor of class \cd{Symbol}. |
| 2610 It is a compile-time error if the type arguments of a constant map literal inclu
de a type parameter. |
2610 | 2611 |
2611 The value of a constant map literal \CONST{}$ <K, V>\{k_1:e_1\ldots k_n :e_n\}$
is an object $m$ whose class implements the built-in class $Map<K, V>$. The ent
ries of $m$ are $u_i:v_i, i \in 1 .. n$, where $u_i$ is the value of the compile
-time expression $k_i$ and $v_i$ is the value of the compile-time expression $e_
i$. The value of a constant map literal \CONST{} $\{k_1:e_1\ldots k_n :e_n\}$
is defined as the value of a constant map literal \CONST{} $<\DYNAMIC{}, \DYNAMI
C{}>\{k_1:e_1\ldots k_n :e_n\}$. | 2612 The value of a constant map literal \CONST{}$ <K, V>\{k_1:e_1\ldots k_n :e_n\}$
is an object $m$ whose class implements the built-in class $Map<K, V>$. The ent
ries of $m$ are $u_i:v_i, i \in 1 .. n$, where $u_i$ is the value of the compile
-time expression $k_i$ and $v_i$ is the value of the compile-time expression $e_
i$. The value of a constant map literal \CONST{} $\{k_1:e_1\ldots k_n :e_n\}$
is defined as the value of a constant map literal \CONST{} $<\DYNAMIC{}, \DYNAMI
C{}>\{k_1:e_1\ldots k_n :e_n\}$. |
2612 | 2613 |
2613 Let $map_1 =$ \CONST{}$ <K, V>\{k_{11}:e_{11} \ldots k_{1n} :e_{1n}\}$ and $map
_2 =$ \CONST{}$ <J, U>\{k_{21}:e_{21} \ldots k_{2n} :e_{2n}\}$ be two constant
map literals. Let the keys of $map_1$ and $map_2$ evaluate to $s_{11} \ldots s
_{1n}$ and $s_{21} \ldots s_{2n}$ respectively, and let the elements of $map
_1$ and $map_2$ evaluate to $o_{11} \ldots o_{1n}$ and $o_{21} \ldots o_{2n}$
respectively. Iff \code{identical($o_{1i}$, $o_{2i}$)} and \code{identical($s_{
1i}$, $s_{2i}$)} for $i \in 1.. n$, and $K = J, V = U$ then \code{identical($map
_1$, $map_2$)}. | 2614 Let $map_1 =$ \CONST{}$ <K, V>\{k_{11}:e_{11} \ldots k_{1n} :e_{1n}\}$ and $map
_2 =$ \CONST{}$ <J, U>\{k_{21}:e_{21} \ldots k_{2n} :e_{2n}\}$ be two constant
map literals. Let the keys of $map_1$ and $map_2$ evaluate to $s_{11} \ldots s
_{1n}$ and $s_{21} \ldots s_{2n}$ respectively, and let the elements of $map
_1$ and $map_2$ evaluate to $o_{11} \ldots o_{1n}$ and $o_{21} \ldots o_{2n}$
respectively. Iff \code{identical($o_{1i}$, $o_{2i}$)} and \code{identical($s_{
1i}$, $s_{2i}$)} for $i \in 1.. n$, and $K = J, V = U$ then \code{identical($map
_1$, $map_2$)}. |
2614 | 2615 |
2615 \commentary{In other words, constant map literals are canonicalized.} | 2616 \commentary{In other words, constant map literals are canonicalized.} |
2616 | 2617 |
2617 A runtime map literal $<K, V>\{k_1:e_1\ldots k_n :e_n\}$ is evaluated as follow
s: | 2618 A runtime map literal $<K, V>\{k_1:e_1\ldots k_n :e_n\}$ is evaluated as follow
s: |
2618 \begin{itemize} | 2619 \begin{itemize} |
2619 \item | 2620 \item |
(...skipping 961 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3581 | 3582 |
3582 | 3583 |
3583 {\bf logicalAndExpression:} | 3584 {\bf logicalAndExpression:} |
3584 equalityExpression (`\&\&' equalityExpression)* | 3585 equalityExpression (`\&\&' equalityExpression)* |
3585 % bitwiseOrExpression (`\&\&' bitwiseOrExpression)* | 3586 % bitwiseOrExpression (`\&\&' bitwiseOrExpression)* |
3586 . | 3587 . |
3587 \end{grammar} | 3588 \end{grammar} |
3588 | 3589 |
3589 A {\em logical boolean expression} is either an equality expression (\ref{equali
ty}), or an invocation of a logical boolean operator on an expression $e_1$ with
argument $e_2$. | 3590 A {\em logical boolean expression} is either an equality expression (\ref{equali
ty}), or an invocation of a logical boolean operator on an expression $e_1$ with
argument $e_2$. |
3590 | 3591 |
3591 Evaluation of a logical boolean expression $b$ of the form $e_1 || e_2$ causes t
he evaluation of $e_1$ and then subjected to boolean conversion, yielding an obj
ect $o_1$; if $o_1$ is true, the result of evaluating $b$ is true, otherwise $e_
2$ is evaluated to an object $o_2$, which is then subjected to boolean conversio
n (\ref{booleanConversion}) producing an object $r$, which is the value of $b$. | 3592 Evaluation of a logical boolean expression $b$ of the form $e_1 || e_2$ causes t
he evaluation of $e_1$ which is then subjected to boolean conversion, yielding
an object $o_1$; if $o_1$ is true, the result of evaluating $b$ is true, otherwi
se $e_2$ is evaluated to an object $o_2$, which is then subjected to boolean con
version (\ref{booleanConversion}) producing an object $r$, which is the value of
$b$. |
3592 | 3593 |
3593 Evaluation of a logical boolean expression $b$ of the form $e_1 \&\& e_2$ causes
the evaluation of $e_1$ and then subjected to boolean conversion, yielding an o
bject $o_1$; if $o_1$ is not true, the result of evaluating $b$ is false, other
wise $e_2$ is evaluated to an object $o_2$, which is then subjected to boolean c
onversion producing an object $r$, which is the value of $b$. | 3594 Evaluation of a logical boolean expression $b$ of the form $e_1 \&\& e_2$ causes
the evaluation of $e_1$ which is then subjected to boolean conversion, yielding
an object $o_1$; if $o_1$ is not true, the result of evaluating $b$ is false,
otherwise $e_2$ is evaluated to an object $o_2$, which is then subjected to bool
ean conversion producing an object $r$, which is the value of $b$. |
3594 | 3595 |
3595 A logical boolean expression $b$ of the form $e_1 \&\& e_2$ shows that a variabl
e $v$ has type | 3596 A logical boolean expression $b$ of the form $e_1 \&\& e_2$ shows that a variabl
e $v$ has type |
3596 $T$ if all of the following conditions hold: | 3597 $T$ if all of the following conditions hold: |
3597 \begin{itemize} | 3598 \begin{itemize} |
3598 \item Either $e_1$ shows that $v$ has type $T$ or $e_2$ shows that $v$ has type
$T$. | 3599 \item Either $e_1$ shows that $v$ has type $T$ or $e_2$ shows that $v$ has type
$T$. |
3599 \item $v$ is a local variable or formal parameter. | 3600 \item $v$ is a local variable or formal parameter. |
3600 \item The variable $v$ is not mutated in $e_2$ or within a closure. | 3601 \item The variable $v$ is not mutated in $e_2$ or within a closure. |
3601 \end{itemize} | 3602 \end{itemize} |
3602 | 3603 |
3603 Furthermore, if all of the following hold: | 3604 Furthermore, if all of the following hold: |
(...skipping 2322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5926 \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. | 5927 \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. |
5927 \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 | 5928 \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 |
5928 \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. | 5929 \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. |
5929 \item The names of type variables are short (preferably single letter). Examples
: T, S, K, V , E. | 5930 \item The names of type variables are short (preferably single letter). Examples
: T, S, K, V , E. |
5930 \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. | 5931 \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. |
5931 \end{itemize} | 5932 \end{itemize} |
5932 } | 5933 } |
5933 | 5934 |
5934 | 5935 |
5935 \end{document} | 5936 \end{document} |
OLD | NEW |