|
32 | 32 | % - Specify that a getter/setter and a method with the same basename is
|
33 | 33 | % an error, also in the case where a class obtains both from its
|
34 | 34 | % superinterfaces.
|
| 35 | +% - Specify the Dart 2.0 rule that you cannot implement, extend or mix-in |
| 36 | +% Function. |
35 | 37 | %
|
36 | 38 | % 2.1
|
37 | 39 | % - Remove 64-bit constraint on integer literals compiled to JavaScript numbers.
|
@@ -8799,7 +8801,7 @@ \subsubsection{Getter Access and Method Extraction}
|
8799 | 8801 | Let $T$ be the static type of $e$.
|
8800 | 8802 | It is a compile-time error if $T$ does not have a method or getter named \id{}
|
8801 | 8803 | unless $T$ is \DYNAMIC{},
|
8802 |
| -or $T$ is \FUNCTION{} and \id{} is \code{call}. |
| 8804 | +or $T$ is \FUNCTION{} and \id{} is \CALL{}. |
8803 | 8805 | The static type of $i$ is:
|
8804 | 8806 |
|
8805 | 8807 | \begin{itemize}
|
@@ -13722,13 +13724,46 @@ \subsection{Function Types}
|
13722 | 13724 | }
|
13723 | 13725 |
|
13724 | 13726 | \LMHash{}%
|
13725 |
| -A function object is always an instance of some class that implements the class \FUNCTION{}. |
| 13727 | +A function object is always an instance of some class that implements the class \FUNCTION{} (\ref{functionType}). |
13726 | 13728 | \commentary{%
|
13727 | 13729 | Consequently, all function types are subtypes of \FUNCTION{}
|
13728 | 13730 | (\ref{subtypes}).
|
13729 | 13731 | }
|
13730 | 13732 |
|
13731 | 13733 |
|
| 13734 | +\subsection{Type \FUNCTION{}} |
| 13735 | +\LMLabel{functionType} |
| 13736 | + |
| 13737 | +\LMHash{}% |
| 13738 | +The built-in class \FUNCTION{} is a supertype of all function types |
| 13739 | +(\ref{functionTypes}). |
| 13740 | +It is impossible to extend, implement, or mix in the class \FUNCTION{}. |
| 13741 | + |
| 13742 | +\LMHash{}% |
| 13743 | +If a class declaration or mixin application has \FUNCTION{} as super-class, |
| 13744 | +it instead uses \OBJECT{} as super-class. |
| 13745 | + |
| 13746 | +\LMHash{}% |
| 13747 | +If a class or mixin declaration implements \FUNCTION{}, it has no effect. |
| 13748 | +It is as if the \FUNCTION was removed from the \code{implements} clause (and if it's the only implemented interface, the entire clause is removed). |
| 13749 | +The resulting class or mixin interface does not have \FUNCTION{} as a super-interface. |
| 13750 | + |
| 13751 | +\LMHash{}% |
| 13752 | +If a mixin application mixes \FUNCTION{} onto a super-class, it follows the |
| 13753 | +normal rules for mixin-application, but since the result of that mixin |
| 13754 | +application is equivalent to a class with \code{implements Function}, and |
| 13755 | +that clause has no effect, the resulting class also does not |
| 13756 | +implement \FUNCTION{}. \commentary{The \FUNCTION{} class declares no |
| 13757 | +concrete instance members, so the mixin application creates a sub-class |
| 13758 | +of the superclass with no new members and no new interfaces.} |
| 13759 | + |
| 13760 | +\rationale{Since using \FUNCTION{} in these ways has no effect, it would be |
| 13761 | +reasonable to disallow it completely, like we do extending, implementing or |
| 13762 | +mixing in types like \code{int} or \code{String}. |
| 13763 | +For backwards compatibility with Dart 1 programs, the syntax is allowed to remain, |
| 13764 | +even if it has no effect. Tools may choose to warning users that their code |
| 13765 | +has no effect.} |
| 13766 | + |
13732 | 13767 | \subsection{Type \DYNAMIC{}}
|
13733 | 13768 | \LMLabel{typeDynamic}
|
13734 | 13769 |
|
@@ -13826,7 +13861,7 @@ \subsection{Type \DYNAMIC{}}
|
13826 | 13861 | function expression invocation where an entity of static type \code{Type} is
|
13827 | 13862 | invoked. Note that it could actually succeed: An overriding implementation
|
13828 | 13863 | of \code{runtimeType} could return an instance whose dynamic type is a subtype
|
13829 |
| - of \code{Type} that has a \code{call} method. |
| 13864 | + of \code{Type} that has a \CALL{} method. |
13830 | 13865 | We decided to make it an error because it is likely to be a mistake,
|
13831 | 13866 | especially in cases like \code{$d$.hashCode()}
|
13832 | 13867 | where a developer might have forgotten that \code{hashCode} is a getter.
|
|
0 commit comments