We have several kinds of members associated with the word 'instance':
- Instance getters, setters, and methods, declared in a class, mixin class, mixin, or enum declaration.
- Instance getters, setters, and methods, declared in an extension declaration.
- Instance getters, setters, and methods, declared in an extension type declaration.
The difference matters in several situations: The first kind are subject to object-oriented dispatch (late binding), and hence they must have a correct override relationship to each other in a superclass chain. The other two kinds are statically resolved, and there is no constraint that corresponds to the 'correct override' relationship.
Next, it is exactly the ones that are subject to OO dispatch that support covariant parameters.
The language specification, and probably several other specification documents, are not always fully explicit about this distinction.
This issue serves as a reminder that we should be more explicit. For example, the current specification of which parameters can be covariant-by-declaration fails to say that it is only supported for dispatched instance methods.
We have several kinds of members associated with the word 'instance':
The difference matters in several situations: The first kind are subject to object-oriented dispatch (late binding), and hence they must have a correct override relationship to each other in a superclass chain. The other two kinds are statically resolved, and there is no constraint that corresponds to the 'correct override' relationship.
Next, it is exactly the ones that are subject to OO dispatch that support
covariantparameters.The language specification, and probably several other specification documents, are not always fully explicit about this distinction.
This issue serves as a reminder that we should be more explicit. For example, the current specification of which parameters can be covariant-by-declaration fails to say that it is only supported for dispatched instance methods.