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-19 (18:33)
From: Brian Smith <brian-l-smith@u...>
Subject: Re: [Caml-list] productivity improvement
John Max Skaller wrote:
> Alessandro Baretta wrote:
> No. (class based) object orientation is utterly flawed as a paradigm, as 
> can be seen by posing the trivial problem of representing any type
 > with a binary operator.
> It just can't be done, the problem is called 'covariance problem'.
> I find it hard to state what the problem is here, but I'll try:
> the problem is you can write an unimplementable interface
> and not get a type error:
>    struct X { virtual bool binop(X const&)const=0; };

Do you really mean _all_ class-based object orientation? Don't 
multimethods and/or overloading help in this case?

bool equals(x : 'a,      y : 'b)      = false ;
bool equals(x : Integer, y : Integer) = x.intValue() = y.intValue() ;
bool equals(x : String,  y : String)  = (* compare all the chars *) ;
bool equals(x : String,  y : Integer) = equals(x, y.toString()) ;

This seems to be what Nice does. Nice is based on the 
ML(less-than-or-equal) type system.

Perhaps, your comments only apply to a certain subset of class-based 
object-orietned languages?

- Brian

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