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.1}} | 8 {\large Version 1.11}} |
9 \author{The Dart Team} | 9 \author{The Dart Team} |
10 \begin{document} | 10 \begin{document} |
11 \maketitle | 11 \maketitle |
12 | 12 |
13 \tableofcontents | 13 \tableofcontents |
14 | 14 |
15 | 15 |
16 \newpage | 16 \newpage |
17 | 17 |
18 \pagestyle{myheadings} | 18 \pagestyle{myheadings} |
(...skipping 3088 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3107 | 3107 |
3108 \commentary{ | 3108 \commentary{ |
3109 \code{$a.b(x)$} is parsed as a method invocation of method \code{$b()$} on objec
t \code{$a$}, not as an invocation of getter \code{$b$} on \code{$a$} followed b
y a function call \code{$(a.b)(x)$}. If a method or getter \code{$b$} exists, t
he two will be equivalent. However, if \code{$b$} is not defined on \code{$a$},
the resulting invocation of \code{noSuchMethod()} would differ. The \code{Invoc
ation} passed to \code{noSuchMethod()} would describe a call to a method \code{$
b$} with argument \code{$x$} in the former case, and a call to a getter \code{$b
$} (with no arguments) in the latter. | 3109 \code{$a.b(x)$} is parsed as a method invocation of method \code{$b()$} on objec
t \code{$a$}, not as an invocation of getter \code{$b$} on \code{$a$} followed b
y a function call \code{$(a.b)(x)$}. If a method or getter \code{$b$} exists, t
he two will be equivalent. However, if \code{$b$} is not defined on \code{$a$},
the resulting invocation of \code{noSuchMethod()} would differ. The \code{Invoc
ation} passed to \code{noSuchMethod()} would describe a call to a method \code{$
b$} with argument \code{$x$} in the former case, and a call to a getter \code{$b
$} (with no arguments) in the latter. |
3110 } | 3110 } |
3111 | 3111 |
3112 Otherwise: | 3112 Otherwise: |
3113 | 3113 |
3114 A function expression invocation $e_f(a_1, \ldots , a_n, x_{n+1}: a_{n+1}, \ldot
s , x_{n+k}: a_{n+k})$ is equivalent to $e_f.call(a_1, \ldots , a_n, x_{n+1}: a_
{n+1}, \ldots , x_{n+k}: a_{n+k})$. | 3114 A function expression invocation $e_f(a_1, \ldots , a_n, x_{n+1}: a_{n+1}, \ldot
s , x_{n+k}: a_{n+k})$ is equivalent to $e_f.call(a_1, \ldots , a_n, x_{n+1}: a_
{n+1}, \ldots , x_{n+k}: a_{n+k})$. |
3115 | 3115 |
3116 \commentary{ | 3116 \commentary{ |
3117 The implication of this definition, and the other definitions involving the meth
od \code{call()}, is that user defined types can be used as function values prov
ided they define a \code{call()} method. The method \code{call()} is special in
this regard. The signature of the \code{call()} method determines the signature
used when using the object via the built-in invocation syntax. | 3117 The implication of this definition, and the other definitions involving the meth
od \code{call()}, is that user defined types can be used as function values prov
ided they define a \CALL{} method. The method \CALL{} is special in this regard.
The signature of the \CALL{} method determines the signature used when using th
e object via the built-in invocation syntax. |
3118 } | 3118 } |
3119 | 3119 |
3120 It is a static warning if the static type $F$ of $e_f$ may not be assigned to a
function type. If $F$ is not a function type, the static type of $i$ is \DYNAMI
C{}. Otherwise | 3120 It is a static warning if the static type $F$ of $e_f$ may not be assigned to a
function type. If $F$ is not a function type, the static type of $i$ is \DYNAMI
C{}. Otherwise |
3121 the static type of $i$ is the declared return type of $F$. | 3121 the static type of $i$ is the declared return type of $F$. |
3122 %\item Let $T_i$ be the static type of $a_i, i \in 1 .. n+k$. It is a static war
ning if $F$ is not a supertype of $(T_1, \ldots, T_n, [T_{n+1}$ $x_{n+1}, \ldot
s, T_{n+k}$ $x_{n+k}]) \to \bot$. | 3122 %\item Let $T_i$ be the static type of $a_i, i \in 1 .. n+k$. It is a static war
ning if $F$ is not a supertype of $(T_1, \ldots, T_n, [T_{n+1}$ $x_{n+1}, \ldot
s, T_{n+k}$ $x_{n+k}]) \to \bot$. |
3123 %\end{itemize} | 3123 %\end{itemize} |
3124 | 3124 |
3125 | 3125 |
3126 \subsection{ Method Invocation} | 3126 \subsection{ Method Invocation} |
3127 \label{methodInvocation} | 3127 \label{methodInvocation} |
(...skipping 1177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4305 % \{$s$\} | 4305 % \{$s$\} |
4306 % $e$; | 4306 % $e$; |
4307 %\}\} | 4307 %\}\} |
4308 %} | 4308 %} |
4309 | 4309 |
4310 %If $c$ is empty, it is interpreted as \TRUE{}. | 4310 %If $c$ is empty, it is interpreted as \TRUE{}. |
4311 | 4311 |
4312 \subsubsection{For-in} | 4312 \subsubsection{For-in} |
4313 \label{for-in} | 4313 \label{for-in} |
4314 | 4314 |
4315 A for statement of the form \code{ \FOR{} ($varOrType?$ id \IN{} $e$) $s$} is eq
uivalent to the following code: | 4315 A for statement of the form \code{ \FOR{} ($finalConstVarOrType?$ id \IN{} $e$)
$s$} is equivalent to the following code: |
4316 | 4316 |
4317 \begin{dartCode} | 4317 \begin{dartCode} |
4318 var n0 = $e$.iterator; | 4318 var n0 = $e$.iterator; |
4319 \WHILE{} (n0.moveNext()) \{ | 4319 \WHILE{} (n0.moveNext()) \{ |
4320 $varOrType?$ id = n0.current; | 4320 $finalConstVarOrType?$ id = n0.current; |
4321 $s$ | 4321 $s$ |
4322 \} | 4322 \} |
4323 \end{dartCode} | 4323 \end{dartCode} |
4324 where \code{n0} is an identifier that does not occur anywhere in the program. | 4324 where \code{n0} is an identifier that does not occur anywhere in the program. |
| 4325 |
| 4326 \commentary{ |
| 4327 Note that in fact, using a \CONST{} variable would give rise to a compile time
error since \cd{n0.current} is not a constant expression. |
| 4328 } |
4325 | 4329 |
4326 \subsection{While} | 4330 \subsection{While} |
4327 \label{while} | 4331 \label{while} |
4328 | 4332 |
4329 The while statement supports conditional iteration, where the condition is evalu
ated prior to the loop. | 4333 The while statement supports conditional iteration, where the condition is evalu
ated prior to the loop. |
4330 | 4334 |
4331 \begin{grammar} | 4335 \begin{grammar} |
4332 {\bf whileStatement:} | 4336 {\bf whileStatement:} |
4333 \WHILE{} `(' expression `)' statement % could do top level here, and in f
or | 4337 \WHILE{} `(' expression `)' statement % could do top level here, and in f
or |
4334 . | 4338 . |
(...skipping 1489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5824 \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. | 5828 \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. |
5825 \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 | 5829 \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 |
5826 \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. | 5830 \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. |
5827 \item The names of type variables are short (preferably single letter). Examples
: T, S, K, V , E. | 5831 \item The names of type variables are short (preferably single letter). Examples
: T, S, K, V , E. |
5828 \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. | 5832 \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. |
5829 \end{itemize} | 5833 \end{itemize} |
5830 } | 5834 } |
5831 | 5835 |
5832 | 5836 |
5833 \end{document} | 5837 \end{document} |
OLD | NEW |