caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Recursive class+type definitions
@ 2007-07-16  1:29 Raj B
  2007-07-16  2:00 ` [Caml-list] " Jon Harrop
  2007-07-16  2:27 ` Chris King
  0 siblings, 2 replies; 4+ messages in thread
From: Raj B @ 2007-07-16  1:29 UTC (permalink / raw)
  To: caml-list

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 =
	object
		method virtual getx : float
		method virtual getlist : mypointlist
	end

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

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

Thanks
Raj


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-07-16  9:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-16  1:29 Recursive class+type definitions Raj B
2007-07-16  2:00 ` [Caml-list] " Jon Harrop
2007-07-16  2:27 ` Chris King
2007-07-16  9:00   ` Jacques GARRIGUE

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).