[m-rev.] for discussion: subtypes documentation

Ralph Becket rafe at cs.mu.OZ.AU
Tue Nov 26 08:05:59 AEDT 2002


Fergus Henderson, Tuesday, 26 November 2002:
> On 25-Nov-2002, Ralph Becket <rafe at cs.mu.OZ.AU> wrote:
> > Can we include a definition of covariance and contravariance here?  I
> > can't remember what they mean and ten minutes of web trawling has left
> > me none the wiser.
> 
> Covariance means that means that they vary together; that is, the
> argument type for a subtype can be a subtype of the base type's argument type
> (and it cannot be a supertype of the base type's argument type).
> 
> Contravariance means that they vary oppositely: that is, the the argument
> type for a subtype must be a supertype of the base type's argument type.
> 
> Invariance (in this context) means that the argument type for a subtype
> must be exactly the same as the argument type for the base type.

Thought it was something like that.  We really should include a version
of the above in the reference manual.

- Ralph
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list