Type-Safe Covariant Specialization with Generalized Matching

Ran Rinat
2002 Information and Computation  
Matching is a relation between object types originally designed to support type-safe subclassing with binary methods. In this paper we generalize it to deal with general covariance by allowing eld and method parameter types to change covariantly in matching types. The result is a signi cant increase in the exibility of subclassing. The generalization is in a di erent direction than the recent proposal for supporting type-safe virtual types via matching between mutually recursive types. The new
more » ... e nition is accompanied by appropriate machinery, allowing the loss of subsumption to be compensated by matchbounded parameterization and hash types, like in the language LOOM. As a bonus of the generalized approach to matching we also obtain a more exible typing for binary methods, allowing instances of a subclass to be supplied as argument. We de ne a language LGM supporting generalized matching, its typing rules, and its operational semantics, and state a subject reduction theorem showing the soundness of the system.
doi:10.1006/inco.2001.3048 fatcat:4qfgobza2bd2vpa24ad67gieeu