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.6}} |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 | 279 |
280 \rationale{Libraries do not reference each other by name and so the idea of a pr
ivate library is meaningless. | 280 \rationale{Libraries do not reference each other by name and so the idea of a pr
ivate library is meaningless. |
281 Thus, if the name of a library begins with an underscore, it has no effect on th
e accessibility of the library or its members. | 281 Thus, if the name of a library begins with an underscore, it has no effect on th
e accessibility of the library or its members. |
282 } | 282 } |
283 | 283 |
284 \rationale{Privacy is, at this point, a static notion tied to a particular piece
of code (a library). It is designed to support software engineering concerns ra
ther than security concerns. Untrusted code should always run in an another isol
ate. It is possible that libraries will become first class objects and privacy
will be a dynamic notion tied to a library instance. | 284 \rationale{Privacy is, at this point, a static notion tied to a particular piece
of code (a library). It is designed to support software engineering concerns ra
ther than security concerns. Untrusted code should always run in an another isol
ate. It is possible that libraries will become first class objects and privacy
will be a dynamic notion tied to a library instance. |
285 | 285 |
286 Privacy is indicated by the name of a declaration - hence privacy and naming are
not orthogonal. This has the advantage that both humans and machines can recogn
ize access to private declarations at the point of use without knowledge of the
context from which the declaration is derived.} | 286 Privacy is indicated by the name of a declaration - hence privacy and naming are
not orthogonal. This has the advantage that both humans and machines can recogn
ize access to private declarations at the point of use without knowledge of the
context from which the declaration is derived.} |
287 | 287 |
288 \subsection{Concurrency} | 288 \subsection{Concurrency} |
| 289 \LMLabel{concurrency} |
289 | 290 |
290 \LMHash{} | 291 \LMHash{} |
291 Dart code is always single threaded. There is no shared-state concurrency in Dar
t. Concurrency is supported via actor-like entities called {\em isolates}. | 292 Dart code is always single threaded. There is no shared-state concurrency in Dar
t. Concurrency is supported via actor-like entities called {\em isolates}. |
292 | 293 |
293 \LMHash{} | 294 \LMHash{} |
294 An isolate is a unit of concurrency. It has its own memory and its own thread of
control. Isolates communicate by message passing (\ref{sendingMessages}). No st
ate is ever shared between isolates. Isolates are created by spawning (\ref{spaw
ningAnIsolate}). | 295 An isolate is a unit of concurrency. It has its own memory and its own thread of
control. Isolates communicate by message passing (\ref{sendingMessages}). No st
ate is ever shared between isolates. Isolates are created by spawning (\ref{spaw
ningAnIsolate}). |
295 | 296 |
296 | 297 |
297 \section{Errors and Warnings} | 298 \section{Errors and Warnings} |
298 \LMLabel{errorsAndWarnings} | 299 \LMLabel{errorsAndWarnings} |
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
710 {\bf simpleFormalParameter:}declaredIdentifier; | 711 {\bf simpleFormalParameter:}declaredIdentifier; |
711 metadata identifier | 712 metadata identifier |
712 . | 713 . |
713 | 714 |
714 {\bf fieldFormalParameter:} | 715 {\bf fieldFormalParameter:} |
715 metadata finalConstVarOrType? \THIS{} `{\escapegrammar .}' identifier formalP
arameterList? | 716 metadata finalConstVarOrType? \THIS{} `{\escapegrammar .}' identifier formalP
arameterList? |
716 . | 717 . |
717 \end{grammar} | 718 \end{grammar} |
718 | 719 |
719 %\subsubsection{Rest Formals} | 720 %\subsubsection{Rest Formals} |
| 721 %\LMLabel{restFormals} |
720 | 722 |
721 %A rest formal $R$ must be the last parameter in a formal parameter list. If a
type $T$ is specified for $R$, it signifies that the type of $R$ is $T[]$. | 723 %A rest formal $R$ must be the last parameter in a formal parameter list. If a
type $T$ is specified for $R$, it signifies that the type of $R$ is $T[]$. |
722 | 724 |
723 %\begin{grammar} | 725 %\begin{grammar} |
724 %restFormalParameter: | 726 %restFormalParameter: |
725 % finalConstVarOrType? '{\escapegrammar ...}' identifier | 727 % finalConstVarOrType? '{\escapegrammar ...}' identifier |
726 %\end{grammar} | 728 %\end{grammar} |
727 | 729 |
728 \subsubsection{Optional Formals} | 730 \subsubsection{Optional Formals} |
729 \LMLabel{optionalFormals} | 731 \LMLabel{optionalFormals} |
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1260 `{\escapegrammar :}' \THIS{} (`{\escapegrammar .}' identifier)? arguments | 1262 `{\escapegrammar :}' \THIS{} (`{\escapegrammar .}' identifier)? arguments |
1261 . | 1263 . |
1262 \end{grammar} | 1264 \end{grammar} |
1263 | 1265 |
1264 % Need to specify exactly how executing a redirecting constructor works | 1266 % Need to specify exactly how executing a redirecting constructor works |
1265 | 1267 |
1266 | 1268 |
1267 %\Q{We now have generative constructors with no bodies as well.} | 1269 %\Q{We now have generative constructors with no bodies as well.} |
1268 | 1270 |
1269 \paragraph{Initializer Lists} | 1271 \paragraph{Initializer Lists} |
| 1272 \LMLabel{initializerLists} |
1270 | 1273 |
1271 \LMHash{} | 1274 \LMHash{} |
1272 An initializer list begins with a colon, and consists of a comma-separated list
of individual {\em initializers}. There are two kinds of initializers. | 1275 An initializer list begins with a colon, and consists of a comma-separated list
of individual {\em initializers}. There are two kinds of initializers. |
1273 \begin{itemize} | 1276 \begin{itemize} |
1274 \item A {\em superinitializer} identifies a {\em superconstructor} - that is, a
specific constructor of the superclass. Execution of the superinitializer caus
es the initializer list of the superconstructor to be executed. | 1277 \item A {\em superinitializer} identifies a {\em superconstructor} - that is, a
specific constructor of the superclass. Execution of the superinitializer caus
es the initializer list of the superconstructor to be executed. |
1275 | 1278 |
1276 \item An {\em instance variable initializer} assigns a value to an individual in
stance variable. | 1279 \item An {\em instance variable initializer} assigns a value to an individual in
stance variable. |
1277 \end{itemize} | 1280 \end{itemize} |
1278 | 1281 |
1279 \begin{grammar} | 1282 \begin{grammar} |
(...skipping 2358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3638 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. | 3641 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. |
3639 } | 3642 } |
3640 | 3643 |
3641 \LMHash{} | 3644 \LMHash{} |
3642 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 | 3645 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 |
3643 the static type of $i$ is the declared return type of $F$. | 3646 the static type of $i$ is the declared return type of $F$. |
3644 %\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$. | 3647 %\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$. |
3645 %\end{itemize} | 3648 %\end{itemize} |
3646 | 3649 |
3647 \subsection{ Lookup} | 3650 \subsection{ Lookup} |
| 3651 \LMLabel{lookup} |
3648 | 3652 |
3649 \subsubsection{Method Lookup} | 3653 \subsubsection{Method Lookup} |
3650 \LMLabel{methodLookup} | 3654 \LMLabel{methodLookup} |
3651 | 3655 |
3652 \LMHash{} | 3656 \LMHash{} |
3653 The result of a lookup of a method $m$ in object $o$ with respect to library $L$
is the result of a lookup of method $m$ in class $C$ with respect to library $
L$, where $C$ is the class of $o$. | 3657 The result of a lookup of a method $m$ in object $o$ with respect to library $L$
is the result of a lookup of method $m$ in class $C$ with respect to library $
L$, where $C$ is the class of $o$. |
3654 | 3658 |
3655 \LMHash{} | 3659 \LMHash{} |
3656 The result of a lookup of method $m$ in class $C$ with respect to library $L$ i
s: | 3660 The result of a lookup of method $m$ in class $C$ with respect to library $L$ i
s: |
3657 If $C$ declares a concrete instance method named $m$ that is accessible to $L$,
then that method is the result of the lookup. Otherwise, if $C$ has a superclas
s $S$, then the result of the lookup is the result of looking up $m$ in $S$ wit
h respect to $L$. Otherwise, we say that the method lookup has failed. | 3661 If $C$ declares a concrete instance method named $m$ that is accessible to $L$,
then that method is the result of the lookup. Otherwise, if $C$ has a superclas
s $S$, then the result of the lookup is the result of looking up $m$ in $S$ wit
h respect to $L$. Otherwise, we say that the method lookup has failed. |
(...skipping 3451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7109 The scope of a documentation comment immediately preceding the declaration of a
class $C$ is the instance scope of $C$, excluding any names introduced via the i
mport namespace of the enclosing library. | 7113 The scope of a documentation comment immediately preceding the declaration of a
class $C$ is the instance scope of $C$, excluding any names introduced via the i
mport namespace of the enclosing library. |
7110 | 7114 |
7111 \LMHash{} | 7115 \LMHash{} |
7112 The scope of a documentation comment immediately preceding the declaration of a
function $f$ is the scope in force at the very beginning of the body of $f$,
excluding any names introduced via the import namespace of the enclosing library
. | 7116 The scope of a documentation comment immediately preceding the declaration of a
function $f$ is the scope in force at the very beginning of the body of $f$,
excluding any names introduced via the import namespace of the enclosing library
. |
7113 | 7117 |
7114 | 7118 |
7115 | 7119 |
7116 | 7120 |
7117 | 7121 |
7118 %\subsection{Grammar} | 7122 %\subsection{Grammar} |
| 7123 %\LMLabel{grammar} |
7119 \subsection{Operator Precedence} | 7124 \subsection{Operator Precedence} |
7120 \LMLabel{operatorPrecedence} | 7125 \LMLabel{operatorPrecedence} |
7121 | 7126 |
7122 \LMHash{} | 7127 \LMHash{} |
7123 Operator precedence is given implicitly by the grammar. | 7128 Operator precedence is given implicitly by the grammar. |
7124 | 7129 |
7125 \commentary{The following non-normative table may be helpful | 7130 \commentary{The following non-normative table may be helpful |
7126 \newline | 7131 \newline |
7127 | 7132 |
7128 \begin{tabular}{| r | r | r | r |} | 7133 \begin{tabular}{| r | r | r | r |} |
(...skipping 26 matching lines...) Expand all Loading... |
7155 \hline | 7160 \hline |
7156 Conditional & e1? e2: e3 & None & 3\\ | 7161 Conditional & e1? e2: e3 & None & 3\\ |
7157 \hline | 7162 \hline |
7158 Cascade & .. & Left & 2\\ | 7163 Cascade & .. & Left & 2\\ |
7159 \hline | 7164 \hline |
7160 Assignment & =, *=, /=, +=, -= ,\&=, \^{}= etc. & Right & 1\\ | 7165 Assignment & =, *=, /=, +=, -= ,\&=, \^{}= etc. & Right & 1\\ |
7161 \hline | 7166 \hline |
7162 \end{tabular} | 7167 \end{tabular} |
7163 } | 7168 } |
7164 %\subsection{Glossary} | 7169 %\subsection{Glossary} |
| 7170 %\LMLabel{glossary} |
7165 | 7171 |
7166 %\bibliographystyle{alpha} | 7172 %\bibliographystyle{alpha} |
7167 %\bibliography{/users/gilad/research/bibs/master} | 7173 %\bibliography{/users/gilad/research/bibs/master} |
7168 \section*{Appendix: Naming Conventions} | 7174 \section*{Appendix: Naming Conventions} |
| 7175 \LMLabel{namingConventions} |
7169 | 7176 |
7170 \commentary{ | 7177 \commentary{ |
7171 The following naming conventions are customary in Dart programs. | 7178 The following naming conventions are customary in Dart programs. |
7172 \begin{itemize} | 7179 \begin{itemize} |
7173 \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. | 7180 \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. |
7174 \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 | 7181 \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 |
7175 \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. | 7182 \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. |
7176 \item The names of type variables are short (preferably single letter). Examples
: T, S, K, V , E. | 7183 \item The names of type variables are short (preferably single letter). Examples
: T, S, K, V , E. |
7177 \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. | 7184 \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. |
7178 \end{itemize} | 7185 \end{itemize} |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7326 | 7333 |
7327 The invariant that each normative paragraph is associated with a line | 7334 The invariant that each normative paragraph is associated with a line |
7328 containing the text \LMHash{} should be maintained. Extra occurrences | 7335 containing the text \LMHash{} should be maintained. Extra occurrences |
7329 of \LMHash{} can be added if needed, e.g., in order to make | 7336 of \LMHash{} can be added if needed, e.g., in order to make |
7330 individual \item{}s in itemized lists addressable. Each \LM.. command | 7337 individual \item{}s in itemized lists addressable. Each \LM.. command |
7331 must occur on a separate line. \LMHash{} must occur immediately | 7338 must occur on a separate line. \LMHash{} must occur immediately |
7332 before the associated paragraph, and \LMLabel must occur immediately | 7339 before the associated paragraph, and \LMLabel must occur immediately |
7333 after the associated \section{}, \subsection{} etc. | 7340 after the associated \section{}, \subsection{} etc. |
7334 | 7341 |
7335 ---------------------------------------------------------------------- | 7342 ---------------------------------------------------------------------- |
OLD | NEW |