info-sather
[Top][All Lists]
Advanced

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

Re: Co-/Contravariance (was: mandatory newbie musing)


From: Norbert Nemec
Subject: Re: Co-/Contravariance (was: mandatory newbie musing)
Date: Tue, 3 Oct 2000 16:15:01 +0200
User-agent: Mutt/1.0.1i

On Tue, Oct 03, 2000 at 12:29:41PM +0000, Fergus Henderson wrote:
> address@hidden (Norbert Nemec) writes:
> 
> >On Mon, Oct 02, 2000 at 09:01:10PM +0000, Matt Kennel wrote:
> >> My opinion on the whole co versus contra thing, having programmed a 
> >> reasonable
> >> amount in both Eiffel and Sather. 
> >> 
> >> Contravariance is always type safe, and checkable at compile time, and
> >> theoretically nice, but in practice, not useful.
> >> 
> >> Covariance is not those things, but seems to be more useful.  
> >
> >What's that? Both are perfectly simple to check at compile time.
> 
> Matt is talking about covariance of *argument* types,
> not covariance of return types.
> 
> Contravariance of argument types and covariance of return types, as
> allowed in Sather, are both simple to check at compile time.
> But Eiffel, unlike Sather, allows covariance of argument types.
> Ensuring type safety in the presence of contravariant argument types
> is not so easy!

??!! When should *covariant* argument types should be legal at all?! 
That would mean that a subtype of a class only takes a subset of types 
as argument for one of its methods. That again means that is does not 
match the full interface. That way the point of interfaces it dropped 
completely! Of course that's not checkable! (Talking only of input 
arguments, of course...)

-- 
-- ______________________________________________________
-- JESUS CHRIST IS LORD!
--          To Him, even that machine here has to obey...
--
-- _________________________________Norbert "Nobbi" Nemec
-- Hindenburgstr. 44  ...  D-91054 Erlangen  ...  Germany
-- eMail: <address@hidden>   Tel: +49-(0)-9131-204180



reply via email to

[Prev in Thread] Current Thread [Next in Thread]