caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: John Max Skaller <skaller@ozemail.com.au>
To: Brian Rogoff <bpr@best.com>
Cc: Tom Hirschowitz <hirschow@mouton.inria.fr>, caml-list@inria.fr
Subject: Re: circular types?
Date: Thu, 26 Oct 2000 01:03:29 +1100	[thread overview]
Message-ID: <39F6E831.621B85E3@ozemail.com.au> (raw)
In-Reply-To: <Pine.BSF.4.21.0010230748080.17875-100000@shell5.ba.best.com>

Brian Rogoff wrote:

> And if you can do that then allowing mutual recursion between
> classes and types also should be allowed.

I think this can be done now. Here is the method: to have a type t
and a class c mutually dependent, for example:

	class type c = object x : t end
	and type  t = C c | Null

write

	class type c' ['t] = object x : 't end
	type t = C t c' | Null
	class type c = t c'

and you have it. In other words, abstract out the types from
the classes by making them type parameters, declare the types,
using appropriately instantiated class types, and then name the
required class instances.

As far as I can see, this always works, and thus shows
(constructively) that mutual recursion between classes and types
can be supported. 

-- 
John (Max) Skaller, mailto:skaller@maxtal.com.au
10/1 Toxteth Rd Glebe NSW 2037 Australia voice: 61-2-9660-0850
checkout Vyper http://Vyper.sourceforge.net
download Interscript http://Interscript.sourceforge.net



  reply	other threads:[~2000-10-25 19:10 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-10-23  7:43 Tom Hirschowitz
2000-10-23 15:35 ` Brian Rogoff
2000-10-25 14:03   ` John Max Skaller [this message]
2000-10-25 19:47     ` Brian Rogoff
2000-10-26  9:12     ` Hendrik Tews
2000-10-26 16:37       ` John Max Skaller
2000-10-24  8:37 ` Hendrik Tews
2000-10-25 14:31   ` John Max Skaller
2000-10-26  8:51     ` Hendrik Tews
  -- strict thread matches above, loose matches on Subject: below --
2000-10-24  8:48 Tom Hirschowitz
2000-10-26  8:39 ` Hendrik Tews
2000-10-26  9:11   ` Tom Hirschowitz
2000-10-20  2:35 Chris Hecker
2000-10-20 12:24 ` Pierre Weis
2000-10-20 21:34   ` Chris Hecker
2000-10-21  8:02     ` Pierre Weis
2000-10-21 18:37       ` Chris Hecker
2000-10-21 12:22     ` Vitaly Lugovsky
2000-10-21 18:29       ` Chris Hecker
2000-10-21 22:36     ` Brian Rogoff
2000-10-23 18:43     ` Anton Moscal

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=39F6E831.621B85E3@ozemail.com.au \
    --to=skaller@ozemail.com.au \
    --cc=bpr@best.com \
    --cc=caml-list@inria.fr \
    --cc=hirschow@mouton.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).