Version française
Home     About     Download     Resources     Contact us    
Browse thread
recursive types
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Erik de Castro Lopo <mle+ocaml@m...>
Subject: Re: [Caml-list] recursive types
Jacques Le Normand wrote:

> hello again list
> is it possible to have mutually recursive classes and types?

Yes and yes.

I haven't played much with classes at all, but recursive types
can be defined as :

  type x_t =
  {  x : int ; y : y_t ; }
  and
  y_t =
  { z : string }

For recursive classes I beleive that you do

   class xxx = ....

   and yyy =

to define mutually recursive classes xxx and yyy.

Erik
-- 
-----------------------------------------------------------------
Erik de Castro Lopo
-----------------------------------------------------------------
Think of XML as Lisp for COBOL programmers.
	-- Tony-A (some guy on /.)
-- 
-----------------------------------------------------------------
Erik de Castro Lopo
-----------------------------------------------------------------
"Microsoft treats security vulnerabilities as public relations
problems."  -- Bruce Schneier