[Prev][Next][Index][Thread]

Covariant Deep Subtyping Reconsidered





For people interested in a full copy of the following paper, please send 
me mail to request a postscript.


	Covariant Deep Subtyping Reconsidered
		  David L. Shang

ABSTRACT

Covariant deep subtyping has been viewed as a way to narrow the range 
of a component in subtypes. In this paper, however, we see covariant 
deep subtyping in a new light -- a way to clarify a vague but fixed 
range of a component in subclasses. We will examine such concepts as 
class substitution, generic class by BETA/Cluster, and a number of 
theoretic approaches in relation to covariant deep subtyping.

1.0. Traditional Covariance Is Neither Sound Nor Required
	-- When subclasses require restrictive covariance, there is 
	   usually an untrue promise in their superclass. 

2.0  Covariance Reconsidered: Range Is Not Narrowed
	-- covariance is not a way to narrow the range of a component, 
	   but rather, a way to clarify a vague but fixed range of a 
	   component in subclasses. 

3.0  Substitution: Type Dependency Should Be Considered
	-- Expand Wegner and Zdonik's definition of substitutability
	   to cover the situiation of type dependency

4.0  Set Theory Reconsidered: Input Type May Depend on Function Type Itself
	-- Reconsider Cardelli's set theory where the input type
	   depends the function type itself

5.0  Practical Work Revisited
	5.1 Class Substitution
		-- discussion of Palsberg and Schwartzbach's class
		   substitution: non-fixed dependency leads the
		   disablement of polymorphism
	5.2 Dynamic Genericity
		-- Beta/Cluster's generic class -- a natual to describe
		   covariance and type dependency:
		   * type dependency is explicitly specified when
		     covariance is required in subclasses(subtypes)
		   * the dependency will be fixed at a certain subclass
		     level from which polymorphism is then enabled
		   * run-time type check is only required by reverse 

		     substitution or cross substitution which is
		     not required by close world assumption
		   * Static local checkability for close world assumption

6.0  Theoretic Work Revisited
	6.1 Covariance Versus Contravariance Debate
		* covariance versus contravariance
		* subclass is not always subtype
		* Castagna's view on covariance
	     Out view:
		* covariance is not a violation to substitutability
		* subclass should be subtype
		* we can live without contravariance
	6.2 Selfclass
		* selfclass dependency
		* a fixed view on selfclass by LOOP
		* selfclass view by Cluster's generic class
	6.3 ML Module Language
		-- a comparison of Cluster's generic class with
		   ML's structure, signature and functor

7.0  Examples Revisited
	7.1  2-D and 3-D Points And Their Equality
		-- Point3D is neither subclass nor subtype of Point2D, but
		   a subclass and a subtype of PointAtLeast2D
	7.2  Homogeneous Object Collection
	7.3  Object Reference
		* type dependency with object reference (pointer)
		* plain subclass match rule by Cluster
		* reference may create a hole without the spec. of
		  type dependency, e.g. C++ object slicing

8.0  Conclusion