Re:Understanding contravariance
by willtim on Friday June 22, 2018 @09:30AM
(#17373784)
IMHO, structural types are a better starting point. Nominal types can always be created by wrapping a structural type, but it is difficult to go the other way round. A language with row types can give a type to a query or have named function arguments. Extensible row types allow even more forms of composition, for example functions that require the presence of certain fields but will ignore others, very similar to subtyping.
[ Parent
| on HN ]
structural vs nominal typing is orthogonal to row polymorphism vs subsumption rule.