2
2
3
3
Author:
[email protected] (
@eernst ).
4
4
5
- Version: 0.1 .
5
+ Version: 0.2 .
6
6
7
7
8
8
## Motivation and Scope
@@ -114,14 +114,32 @@ evaluated as an expression, it is subject to instantiation to bound.
114
114
* This treatment of generic type aliases is again the same as it was
115
115
previously, but it involves a larger set of types.*
116
116
117
- * Note that type aliases introduce types and not classes. Consequently, a
118
- type alias can ** not** be used in a position where a class is expected: in the
119
- ` extends ` , ` with ` , ` implements ` , or ` on ` clause of a class or mixin
120
- declaration; for a static member access; or in an instance creation
121
- expression (` new F() ` , ` const F<int>() ` ). On the other hand, it ** can** be
122
- used as a type annotation, as a type argument, as part of a function type
123
- or function signature, as a type literal, in an ` on ` clause of a ` try `
124
- statement, in a type test (` e is F ` ), and in a type cast (` e as F ` ).*
117
+ A type alias application of the form _ F_ or the form
118
+ _ F< ; T<sub >1</sub >..T<sub >k</sub >> ; _ can be used as a type annotation,
119
+ as a type argument, as part of a function type or a function signature, as
120
+ a type literal, in an ` on ` clause of a ` try ` statement, in a type test
121
+ (` e is F ` ), and in a type cast (` e as F ` ).
122
+
123
+ ** The following is under discussion. Exactly one rule will be confirmed.
124
+ The following two variants are considered, along with small variations or
125
+ hybrids thereof:**
126
+
127
+ * A type alias can _ not_ be used in a position where a class is
128
+ expected: in the ` extends ` , ` with ` , ` implements ` , or ` on ` clause of a
129
+ class or mixin declaration; for a static member access; or in an
130
+ instance creation expression (` new F() ` , ` const F<int>() ` ). OR
131
+
132
+ * A type alias can _ not_ be used for static member accesses. When a type
133
+ alias _ F_ resp. _ F< ; T<sub >1</sub >..T<sub >k</sub >> ; _ occurs as the
134
+ entity that a class ` extends ` and when it occurs in a ` with ` clause or
135
+ ` implements ` clause of a class or an ` on ` clause of a mixin, or it is
136
+ used in an instance creation expression, it is a compile-time error
137
+ unless it denotes a class, otherwise it is treated as if that class had
138
+ been specified explicitly.
139
+ (* E.g., ` class C extends myPrefix.F<int> {} ` would be equivalent to
140
+ ` class C extends D<List<int>, int> {} ` if the library imported as
141
+ ` myPrefix ` contains ` typedef F<X> = D<List<X>, X>; ` , assuming that
142
+ ` D ` is accessible to the current library and has no prefix.* )
125
143
126
144
127
145
### Dynamic Semantics
@@ -146,4 +164,7 @@ fresh type variable bound to the denoted type.
146
164
147
165
## Versions
148
166
167
+ * Nov 8th, 2018, version 0.2: Marking the design decision of where to allow
168
+ usages of type aliases denoting classes as under discussion.
169
+
149
170
* Nov 6th, 2018, version 0.1: Initial version of this document.
0 commit comments