caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Raj B <rajb@rice.edu>
To: caml-list@yquem.inria.fr
Subject: Recursive class+type definitions
Date: Sun, 15 Jul 2007 20:29:47 -0500	[thread overview]
Message-ID: <11E0700C-4331-42AB-88F1-E6BD21D72F78@rice.edu> (raw)

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


             reply	other threads:[~2007-07-16  1:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-16  1:29 Raj B [this message]
2007-07-16  2:00 ` [Caml-list] " Jon Harrop
2007-07-16  2:27 ` Chris King
2007-07-16  9:00   ` Jacques GARRIGUE
2007-07-18 10:22 Christopher Cramer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=11E0700C-4331-42AB-88F1-E6BD21D72F78@rice.edu \
    --to=rajb@rice.edu \
    --cc=caml-list@yquem.inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).