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 \usepackage[T1]{fontenc} | 8 \usepackage[T1]{fontenc} |
9 \newcommand{\code}[1]{{\sf #1}} | 9 \newcommand{\code}[1]{{\sf #1}} |
10 \title{Dart Programming Language Specification \\ | 10 \title{Dart Programming Language Specification \\ |
(...skipping 1764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1775 %The superclass clause of a class C is processed within the enclosing scope of t he static scope of C. | 1775 %The superclass clause of a class C is processed within the enclosing scope of t he static scope of C. |
1776 %\commentary{ | 1776 %\commentary{ |
1777 %This means that in a generic class, the type parameters of the generic are avai lable in the superclass clause. | 1777 %This means that in a generic class, the type parameters of the generic are avai lable in the superclass clause. |
1778 %} | 1778 %} |
1779 | 1779 |
1780 \LMHash{} | 1780 \LMHash{} |
1781 The scope of the \EXTENDS{} and \WITH{} clauses of a class $C$ is the type-param eter scope of $C$. | 1781 The scope of the \EXTENDS{} and \WITH{} clauses of a class $C$ is the type-param eter scope of $C$. |
1782 | 1782 |
1783 \LMHash{} | 1783 \LMHash{} |
1784 %It is a compile-time error if the \EXTENDS{} clause of a class $C$ includes a type expression that does not denote a class available in the lexical scope of $ C$. | 1784 %It is a compile-time error if the \EXTENDS{} clause of a class $C$ includes a type expression that does not denote a class available in the lexical scope of $ C$. |
1785 It is a compile-time error if the \EXTENDS{} clause of a class $C$ specifies an enumerated type (\ref{enums}), a malformed type or a deferred type (\ref{stati cTypes}) as a superclass. | 1785 It is a compile-time error if the \EXTENDS{} clause of a class $C$ specifies a t ype variable (\ref{generics}), a type alias (\ref{typedef}), an enumerated type (\ref{enums}), a malformed type, or a deferred type (\ref{staticTypes}) as a sup erclass. |
1786 It is a compile-time error if the \EXTENDS{} clause of a class $C$ specifies typ e \DYNAMIC{} as a superinterface. | |
1786 % too strict? Do we e want extends List<Undeclared> to work as List<dynamic>? | 1787 % too strict? Do we e want extends List<Undeclared> to work as List<dynamic>? |
1787 | 1788 |
1788 \commentary{ The type parameters of a generic class are available in the lexical scope of the superclass clause, potentially shadowing classes in the surroundin g scope. The following code is therefore illegal and should cause a compile-time error: | 1789 \commentary{ The type parameters of a generic class are available in the lexical scope of the superclass clause, potentially shadowing classes in the surroundin g scope. The following code is therefore illegal and should cause a compile-time error: |
1789 } | 1790 } |
1790 | 1791 |
1791 \begin{dartCode} | 1792 \begin{dartCode} |
1792 class T \{\} | 1793 class T \{\} |
1793 | 1794 |
1794 /* Compilation error: Attempt to subclass a type parameter */ | 1795 /* Compilation error: Attempt to subclass a type parameter */ |
1795 class G<T> extends T \{\} | 1796 class G<T> extends T \{\} |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1910 \begin{grammar} | 1911 \begin{grammar} |
1911 {\bf interfaces:} | 1912 {\bf interfaces:} |
1912 \IMPLEMENTS{} typeList | 1913 \IMPLEMENTS{} typeList |
1913 . | 1914 . |
1914 \end{grammar} | 1915 \end{grammar} |
1915 | 1916 |
1916 \LMHash{} | 1917 \LMHash{} |
1917 The scope of the \IMPLEMENTS{} clause of a class $C$ is the type-parameter scope of $C$. | 1918 The scope of the \IMPLEMENTS{} clause of a class $C$ is the type-parameter scope of $C$. |
1918 | 1919 |
1919 \LMHash{} | 1920 \LMHash{} |
1920 It is a compile-time error if the \IMPLEMENTS{} clause of a class $C$ specifie s a type variable as a superinterface. It is a compile-time error if the \IMPL EMENTS{} clause of a class $C$ specifies an enumerated type (\ref{enums}), a ma lformed type or deferred type (\ref{staticTypes}) as a superinterface. It is a compile-time error if the \IMPLEMENTS{} clause of a class $C$ specifies type \DY NAMIC{} as a superinterface. It is a compile-time error if the \IMPLEMENTS{} c lause of a class $C$ specifies a type $T$ as a superinterface more than once. | 1921 It is a compile-time error if the \IMPLEMENTS{} clause of a class $C$ specifies a type variable (\ref{generics}), a type alias (\ref{typedef}), an enumerated ty pe (\ref{enums}), a malformed type, or a deferred type (\ref{staticTypes}) as a superinterface. |
1922 It is a compile-time error if the \IMPLEMENTS{} clause of a class $C$ specifies type \DYNAMIC{} as a superinterface. | |
1923 It is a compile-time error if the \IMPLEMENTS{} clause of a class $C$ specifies a type $T$ as a superinterface more than once. | |
1921 It is a compile-time error if the superclass of a class $C$ is specified as a su perinterface of $C$. | 1924 It is a compile-time error if the superclass of a class $C$ is specified as a su perinterface of $C$. |
1922 | 1925 |
1923 \rationale{ | 1926 \rationale{ |
1924 One might argue that it is harmless to repeat a type in the superinterface list, so why make it an error? The issue is not so much that the situation described in program source is erroneous, but that it is pointless. As such, it is an indi cation that the programmer may very well have meant to say something else - and that is a mistake that should be called to her or his attention. Nevertheless, we could simply issue a warning; and perhaps we should and will. That said, prob lems like these are local and easily corrected on the spot, so we feel justified in taking a harder line. | 1927 One might argue that it is harmless to repeat a type in the superinterface list, so why make it an error? The issue is not so much that the situation described in program source is erroneous, but that it is pointless. As such, it is an indi cation that the programmer may very well have meant to say something else - and that is a mistake that should be called to her or his attention. Nevertheless, we could simply issue a warning; and perhaps we should and will. That said, prob lems like these are local and easily corrected on the spot, so we feel justified in taking a harder line. |
1925 } | 1928 } |
1926 | 1929 |
1927 \LMHash{} | 1930 \LMHash{} |
1928 It is a compile-time error if the interface of a class $C$ is a superinterface o f itself. | 1931 It is a compile-time error if the interface of a class $C$ is a superinterface o f itself. |
1929 | 1932 |
1930 \LMHash{} | 1933 \LMHash{} |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2083 \rationale{ | 2086 \rationale{ |
2084 This restriction is temporary. We expect to remove it in later versions of Dart . | 2087 This restriction is temporary. We expect to remove it in later versions of Dart . |
2085 | 2088 |
2086 The restriction on constructors simplifies the construction of mixin application s because the process of creating instances is simpler. | 2089 The restriction on constructors simplifies the construction of mixin application s because the process of creating instances is simpler. |
2087 } | 2090 } |
2088 | 2091 |
2089 \subsection{Mixin Application} | 2092 \subsection{Mixin Application} |
2090 \LMLabel{mixinApplication} | 2093 \LMLabel{mixinApplication} |
2091 | 2094 |
2092 \LMHash{} | 2095 \LMHash{} |
2093 A mixin may be applied to a superclass, yielding a new class. Mixin application occurs when a mixin is mixed into a class declaration via its \WITH{} clause. T he mixin application may be used to extend a class per section (\ref{classes}); alternately, a class may be defined as a mixin application as described in this section. It is a compile-time error if the \WITH{} clause of a mixin applicati on $C$ includes a deferred type expression. | 2096 A mixin may be applied to a superclass, yielding a new class. |
2094 | 2097 Mixin application occurs when a mixin is mixed into a class declaration via its \WITH{} clause. |
2098 The mixin application may be used to extend a class per section (\ref{classes}); alternately, a class may be defined as a mixin application as described in this section. | |
2099 It is a compile-time error if the \WITH{} clause of a mixin application $C$ incl udes a type variable (\ref{generics}), a type alias (\ref{typedef}), an enumerat ed type (\ref{enums}), a malformed type, or a deferred type (\ref{staticTypes}). | |
Lasse Reichstein Nielsen
2016/12/16 12:12:02
It would be much easier if we had a definition of
eernst
2016/12/16 13:06:04
Right, which was basically what Gilad already had
| |
2095 | 2100 |
2096 \begin{grammar} | 2101 \begin{grammar} |
2097 {\bf mixinApplicationClass:} | 2102 {\bf mixinApplicationClass:} |
2098 identifier typeParameters? `=' mixinApplication `{\escapegrammar ;}' . | 2103 identifier typeParameters? `=' mixinApplication `{\escapegrammar ;}' . |
2099 | 2104 |
2100 {\bf mixinApplication:} | 2105 {\bf mixinApplication:} |
2101 type mixins interfaces? | 2106 type mixins interfaces? |
2102 . | 2107 . |
2103 \end{grammar} | 2108 \end{grammar} |
2104 | 2109 |
(...skipping 5898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
8003 | 8008 |
8004 The invariant that each normative paragraph is associated with a line | 8009 The invariant that each normative paragraph is associated with a line |
8005 containing the text \LMHash{} should be maintained. Extra occurrences | 8010 containing the text \LMHash{} should be maintained. Extra occurrences |
8006 of \LMHash{} can be added if needed, e.g., in order to make | 8011 of \LMHash{} can be added if needed, e.g., in order to make |
8007 individual \item{}s in itemized lists addressable. Each \LM.. command | 8012 individual \item{}s in itemized lists addressable. Each \LM.. command |
8008 must occur on a separate line. \LMHash{} must occur immediately | 8013 must occur on a separate line. \LMHash{} must occur immediately |
8009 before the associated paragraph, and \LMLabel must occur immediately | 8014 before the associated paragraph, and \LMLabel must occur immediately |
8010 after the associated \section{}, \subsection{} etc. | 8015 after the associated \section{}, \subsection{} etc. |
8011 | 8016 |
8012 ---------------------------------------------------------------------- | 8017 ---------------------------------------------------------------------- |
OLD | NEW |