Version française
Home     About     Download     Resources     Contact us    
Browse thread
Why can't I call a function over a subclass?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: David Teller <David.Teller@e...>
Subject: Re: [Caml-list] Why can't I call a function over a subclass?
I agree with Luca that it's disconcerting. 
When r is a class, I would expect 
 let f (x:r) (y:r) =...
to have a type such as
 x :> r -> y :> r -> ...

Cheers,
 David

On Fri, 2007-10-05 at 10:01 +0200, Florian Hars wrote:
> Luca de Alfaro schrieb:
> > The absurdity continues:
> 
> This is not absurd, this is the documented correct behaviuor.
> If *you* decide that f must only accept arguments of *exactly*
> type r, the typechecker enforces your decision, as it does if
> you decide that f may also accept subtypes of r (as long as your
> decisions are consistent within he type system).
> 
> Yours, Florian.
> 
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs