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
Recursive class+type definitions
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Raj B <rajb@r...>
Subject: Recursive class+type definitions
Hi all

Can we have mutually recursive definitions mixing types and classes?  
For example, I want to define
a class called mypoint, which contains another data structure (say, a  
custom list) of mypoints.

class virtual mypoint =
		method virtual getx : float
		method virtual getlist : mypointlist

type mypointlist = Empty | Cons of (mypoint * mypointlist)

What is the best way to achieve this kind of mutual recursion?