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
mutually dependent class and type
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Sébastien Hinderer <Sebastien.Hinderer@e...>
Subject: mutually dependent class and type
Dear list,

Is there a (clean) way to define simultaneously a class and a type that
are mutually recursive ?
Something like this :
class element (c : content) =
end and type content =
  | Data of string
  | Elements of element list;;

This is of course not a valid OCaml definition, but is there a way to
express it ?

Many thanks in advance for your help,