If and , a function of type safely supplies a contract of type . Every input permitted by the new contract is already accepted, and every possible returned value meets the weakened result promise. The input constraint reverses subtyping, while the output constraint preserves subtyping. Reversing either direction can respectively supply an unsupported input or promise a result more specific than the implementation returns. A language's generic type type constructor may nevertheless be invariant unless its declaration exposes the appropriate type variance.
Articles by others on the same topic
There are currently no matching articles.