On Fri, 2005-02-11 at 09:01 -0500, Swaroop Sridhar wrote:
> Let me illustrate the example by Cook, Hill and Canning:
>
> If the base class has type:
> t1 = mu t. {eq: t->bool} // binary operator that compares
> another object to self
>
> and the inhetited class has type:
> t2 = mu t. {eq: t -> bool ; abc: someotherthing} // In t ->bool, t HAS
> to be the child type
>
> Obviously, t2 not <: t1 (because of the t in function argument position).
I think this mis-diagnoses the problem. The issue here is not subtyping
with subclassing. The issue is how these interact with overloading.
There is no plan at the present time to allow a subclass to alter the
signature of a method defined in a superclass.
In a polymorphic language, the issue above indicates that the programmer
failed to implement eq correctly. The correct signature for
extensibility purposes would be
eq : 'a -> bool
with a distinct implementation supplied by the subclass, but having
precisely the same signature as the original.
The real problem here is the introduction of contravariance and
covariance, which was a mistake.
_______________________________________________
bitc-dev mailing list
[email protected]
http://www.coyotos.org/mailman/listinfo/bitc-dev