Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Recursive classes and subtyping
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Claudio Sacerdoti Coen <sacerdot@c...>
Subject: Re: [Caml-list] Recursive classes and subtyping
>  It works, thanks!!!

 Obviously, I was a bit too quick! I think that the trick works only up to
 the point where the mutual recursion is fake. This is a slightly more
 complex example:

# type -'a t;;

# let f (x : [> `A] t) = (x : [`A] t);;

# class c (newd : [> `A] t -> d) (obj : [> `A] t) =
 object
  method d = newd (f obj)
 end
and d (newc : [> `A] t -> c) (obj : [> `A] t) =
 object
  method c = newc (f obj)
 end
;;
class c : ([ `A] t -> d) -> [ `A] t -> object method d : d end
class d : ([ `A] t -> c) -> [ `A] t -> object method c : c end


 I leave it for the real ocaml gurus!

					Regards,
					C.S.C.

-- 
----------------------------------------------------------------
Real name: Claudio Sacerdoti Coen
PhD Student in Computer Science at University of Bologna
E-mail: sacerdot@cs.unibo.it
http://caristudenti.cs.unibo.it/~sacerdot
----------------------------------------------------------------
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr