Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Re: [Caml-list] productivity improvement
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2002-07-20 (17:49)
From: John Max Skaller <skaller@o...>
Subject: Re: [Caml-list] productivity improvement
Alessandro Baretta wrote:

>>    struct X { virtual bool binop(X const&)const=0; };
> Tell me if I got this straight: OO polymorphism requires that 
> inheriting classes wishing to override methods of parents must use 
> covariant return types and contravariant parameter types, so as to 
> guarantee that inheritance implies subtyping. In this case, it would 
> be meaning less to implement interface X because, applying the 
> contravariance principle to the formal parameter of binop, you'd end 
> up with a class whose binop will accept as rhs parameters any instance 
> of any subtype of X. Therefore a class Integer will have a 
> greater_than_binop accepting instances of class Rational, Real, 
> Complex, Quaternion ... This is meaningless, of course, so we conclude 
> that establishing an identity between inheritance and subtyping 
> relations is paradoxical. Correct? 

The problem is that for arbitrary implementations of the abstractionX,
you clearly cannot encode the primitive binop without knowing
the representation of 'this' and the argument. This is a precise
assertion compared to saying it is 'meaningless': often there
is a good meaning (sure you can add Rationals and quaternions .. :-)

Note that the assertion is not a theorem: it is an *assumption*.
So it cannot be questioned.

>> In commerical applications, almost ALL data is relational,
>> and so cannot be abstracted. The OO paradigm is not just
>> useless here, but downright destructive.
> Slow... What? I don't follow you here. 

A relational database is just an encoding of
functions like

    'a ~b'

by making a table of a and b columns.
But ~ is a binary operator.

John Max Skaller,
snail:10/1 Toxteth Rd, Glebe, NSW 2037, Australia.

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: