From: briand@aracnet.com
To: caml-list@inria.fr
Subject: mutually recursive classes (yes - again)
Date: Sun, 9 Jan 2005 19:49:37 -0800 [thread overview]
Message-ID: <16865.64337.367003.181340@soggy.deldotd.com> (raw)
I've read the other threads on this common subject and I am not
getting understanding.
So I present the following very simple example with the hopes that
some kind person will help.
The definition is very simple making use of the "and" keyword
class type a1 =
object
val a:a1
val b:a2
end
and a2
object
val c:a2
val d:a1
end
;;
It's the implementation which gives me trouble. And yes there is an
example in the manual (3.15) and it just doesn't go quite far
enough...
now I have to define the clases
class a1 (x:a1) (y:a2) =
object
val a = x
val b = y
end
;;
class a2 (x:a2) (y:a1) =
object
val c = x
val d = y
end
;;
So now
let z1 = new a1 ?? ?? ;;
let z2 = new a2 ?? ?? ;;
Obviously I need to "ground" the recursion somehow, but without some
sort of "Null" or "Void" value to use to instantiate the a1 field of
a1 it's not obvious to me how to do it.
I'm sure it will be embarassingly simple ...
I have about 7 more classes in this recursion-fest and a nice orderly
way to handle it would be VERY helpful.
TIA.
Brian
next reply other threads:[~2005-01-10 3:49 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-01-10 3:49 briand [this message]
2005-01-10 7:35 ` [Caml-list] " skaller
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=16865.64337.367003.181340@soggy.deldotd.com \
--to=briand@aracnet.com \
--cc=caml-list@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