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 (4th edition draft)\\ | 10 (4th edition draft)\\ |
(...skipping 2029 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2040 \LMHash{} | 2040 \LMHash{} |
2041 A mixin application of the form \code{$S$ \WITH{} $M$;} defines a class $C$ w ith superclass $S$. | 2041 A mixin application of the form \code{$S$ \WITH{} $M$;} defines a class $C$ w ith superclass $S$. |
2042 | 2042 |
2043 \LMHash{} | 2043 \LMHash{} |
2044 A mixin application of the form \code{$S$ \WITH{} $M_1, \ldots, M_k$;} defines a class $C$ whose superclass is the application of the mixin composition (\ref {mixinComposition}) $M_{k-1} * \ldots * M_1$ to $S$. | 2044 A mixin application of the form \code{$S$ \WITH{} $M_1, \ldots, M_k$;} defines a class $C$ whose superclass is the application of the mixin composition (\ref {mixinComposition}) $M_{k-1} * \ldots * M_1$ to $S$. |
2045 | 2045 |
2046 \LMHash{} | 2046 \LMHash{} |
2047 In both cases above, $C$ declares the same instance members as $M$ (respectively , $M_k$). If any of the instance fields of $M$ (respectively, $M_k$) have initia lizers, they are executed in the scope of $M$ (respectively, $M_k$) to initializ e the corresponding fields of $C$. | 2047 In both cases above, $C$ declares the same instance members as $M$ (respectively , $M_k$). If any of the instance fields of $M$ (respectively, $M_k$) have initia lizers, they are executed in the scope of $M$ (respectively, $M_k$) to initializ e the corresponding fields of $C$. |
2048 | 2048 |
2049 \LMHash{} | 2049 \LMHash{} |
2050 For each generative constructor named $q_i(T_{i1}$ $ a_{i1}, \ldots , T_{ik_i}$ $ a_{ik_i}), i \in 1..n$ of $S$, $C$ has an implicitly declared constructor name d | 2050 Let $L_M$ be the library in which $M$ is declared. |
2051 For each generative constructor named $q_i(T_{i1}$ $ a_{i1}, \ldots , T_{ik_i}$ $ a_{ik_i}), i \in 1..n$ of $S$ that is accessible to $L_M$, $C$ has an implicit ly declared constructor named | |
2051 $q'_i = [C/S]q_i$ of the form | 2052 $q'_i = [C/S]q_i$ of the form |
2052 | 2053 |
2053 $q'_i(a_{i1}, \ldots , a_{ik_i}):\SUPER(a_{i1}, \ldots , a_{ik_i});$. | 2054 $q'_i(a_{i1}, \ldots , a_{ik_i}):\SUPER(a_{i1}, \ldots , a_{ik_i});$. |
2054 | 2055 |
2055 %super.id | 2056 %super.id |
2056 | 2057 |
2057 \LMHash{} | 2058 \LMHash{} |
2058 If the mixin application declares support for interfaces, the resulting class im plements those interfaces. | 2059 If the mixin application declares support for interfaces, the resulting class im plements those interfaces. |
2059 | 2060 |
2060 \LMHash{} | 2061 \LMHash{} |
(...skipping 4720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6781 The policy above makes libraries more robust in the face of additions made to th eir imports. | 6782 The policy above makes libraries more robust in the face of additions made to th eir imports. |
6782 | 6783 |
6783 A clear distinction needs to be made between this approach, and seemingly simila r policies with respect to classes or interfaces. The use of a class or interfa ce, and of its members, is separate from its declaration. The usage and declarat ion may occur in widely separated places in the code, and may in fact be authore d by different people or organizations. It is important that errors are given a t the offending declaration so that the party that receives the error can respon d to it a meaningful way. | 6784 A clear distinction needs to be made between this approach, and seemingly simila r policies with respect to classes or interfaces. The use of a class or interfa ce, and of its members, is separate from its declaration. The usage and declarat ion may occur in widely separated places in the code, and may in fact be authore d by different people or organizations. It is important that errors are given a t the offending declaration so that the party that receives the error can respon d to it a meaningful way. |
6784 | 6785 |
6785 In contrast a library comprises both imports and their usage; the library is und er the control of a single party and so any problem stemming from the import can be resolved even if it is reported at the use site. | 6786 In contrast a library comprises both imports and their usage; the library is und er the control of a single party and so any problem stemming from the import can be resolved even if it is reported at the use site. |
6786 | 6787 |
6787 %On a related note, the provenance of the conflicting elements is not considered . An element that is imported via distinct paths may conflict with itself. This avoids variants of the well known "diamond" problem. | 6788 %On a related note, the provenance of the conflicting elements is not considered . An element that is imported via distinct paths may conflict with itself. This avoids variants of the well known "diamond" problem. |
6788 } | 6789 } |
6789 | 6790 |
6790 \LMHash{} | 6791 \LMHash{} |
6791 It is a static warning to import two different libraries with the same name. | 6792 It is a static warning to import two different libraries with the same name unle ss their name is the empty string. |
Brian Wilkerson
2015/08/19 17:51:00
Do we want similar wording for the export-related
| |
6792 | 6793 |
6793 \commentary{ | 6794 \commentary{ |
6794 A widely disseminated library should be given a name that will not conflict with other such libraries. The preferred mechanism for this is using pub, the Dart p ackage manager, which provides a global namespace for libraries, and conventions that leverage that namespace. | 6795 A widely disseminated library should be given a name that will not conflict with other such libraries. The preferred mechanism for this is using pub, the Dart p ackage manager, which provides a global namespace for libraries, and conventions that leverage that namespace. |
6795 } | 6796 } |
6796 | 6797 |
6797 \commentary{Note that no errors or warnings are given if one hides or shows a na me that is not in a namespace.} | 6798 \commentary{Note that no errors or warnings are given if one hides or shows a na me that is not in a namespace.} |
6798 \rationale{ | 6799 \rationale{ |
6799 This prevents situations where removing a name from a library would cause breaka ge of a client library. | 6800 This prevents situations where removing a name from a library would cause breaka ge of a client library. |
6800 } | 6801 } |
6801 | 6802 |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7045 Any use of a malformed type gives rise to a static warning. A malformed type i s then interpreted as \DYNAMIC{} by the static type checker and the runtime unle ss explicitly specified otherwise. | 7046 Any use of a malformed type gives rise to a static warning. A malformed type i s then interpreted as \DYNAMIC{} by the static type checker and the runtime unle ss explicitly specified otherwise. |
7046 | 7047 |
7047 \rationale{ | 7048 \rationale{ |
7048 This ensures that the developer is spared a series of cascading warnings as the malformed type interacts with other types. | 7049 This ensures that the developer is spared a series of cascading warnings as the malformed type interacts with other types. |
7049 } | 7050 } |
7050 | 7051 |
7051 \LMHash{} | 7052 \LMHash{} |
7052 A type $T$ is {\em deferred} iff it is of the form $p.T$ where $p$ is a deferred prefix. | 7053 A type $T$ is {\em deferred} iff it is of the form $p.T$ where $p$ is a deferred prefix. |
7053 It is a static warning to use a deferred type in a type annotation, type test, t ype cast or as a type parameter. However, all other static warnings must be issu ed under the assumption that all deferred libraries have successfully been loade d. | 7054 It is a static warning to use a deferred type in a type annotation, type test, t ype cast or as a type parameter. However, all other static warnings must be issu ed under the assumption that all deferred libraries have successfully been loade d. |
7054 | 7055 |
7056 % Now, when passed to a generic, p.T also has to be treated as dynamic - otherwi se we have to fail immediately. Where do we say that? And how does this fit with idea that as a type object it fails? Should we say that the accessor on p retur ns dynamic instead of failing? Do we distinguish its use in a constructor vs its use in an annotation? It's not that we evaluate type objects in constructor arg s - these cannot represent parameterized types. | |
7057 | |
7055 | 7058 |
7056 \subsubsection{Type Promotion} | 7059 \subsubsection{Type Promotion} |
7057 \LMLabel{typePromotion} | 7060 \LMLabel{typePromotion} |
7058 | 7061 |
7059 \LMHash{} | 7062 \LMHash{} |
7060 The static type system ascribes a static type to every expression. In some case s, the types of local variables and formal parameters may be promoted from their declared types based on control flow. | 7063 The static type system ascribes a static type to every expression. In some case s, the types of local variables and formal parameters may be promoted from their declared types based on control flow. |
7061 | 7064 |
7062 \LMHash{} | 7065 \LMHash{} |
7063 We say that a variable $v$ is known to have type $T$ whenever we allow the type of $v$ to be promoted. The exact circumstances when type promotion is allowed ar e given in the relevant sections of the specification (\ref{logicalBooleanExpres sions}, \ref{conditional} and \ref{if}). | 7066 We say that a variable $v$ is known to have type $T$ whenever we allow the type of $v$ to be promoted. The exact circumstances when type promotion is allowed ar e given in the relevant sections of the specification (\ref{logicalBooleanExpres sions}, \ref{conditional} and \ref{if}). |
7064 | 7067 |
(...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7864 | 7867 |
7865 The invariant that each normative paragraph is associated with a line | 7868 The invariant that each normative paragraph is associated with a line |
7866 containing the text \LMHash{} should be maintained. Extra occurrences | 7869 containing the text \LMHash{} should be maintained. Extra occurrences |
7867 of \LMHash{} can be added if needed, e.g., in order to make | 7870 of \LMHash{} can be added if needed, e.g., in order to make |
7868 individual \item{}s in itemized lists addressable. Each \LM.. command | 7871 individual \item{}s in itemized lists addressable. Each \LM.. command |
7869 must occur on a separate line. \LMHash{} must occur immediately | 7872 must occur on a separate line. \LMHash{} must occur immediately |
7870 before the associated paragraph, and \LMLabel must occur immediately | 7873 before the associated paragraph, and \LMLabel must occur immediately |
7871 after the associated \section{}, \subsection{} etc. | 7874 after the associated \section{}, \subsection{} etc. |
7872 | 7875 |
7873 ---------------------------------------------------------------------- | 7876 ---------------------------------------------------------------------- |
OLD | NEW |