caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: William Harold Newman <william.newman@airmail.net>
To: caml-list@inria.fr
Subject: [Caml-list] limits on mutual recursion and modules?
Date: Wed, 21 Nov 2001 19:53:39 -0600	[thread overview]
Message-ID: <20011121195339.A24894@rootless> (raw)

I'm trying to understand the limits on mutual recursion in ML.

I've seen the hack
  type 'a combination = T1 of int | T2 of 'a | T3 of 'a * 'a
  class virtual test =
    object
      method virtual get: test combination
    end
for mutual recursion between classes and modules in OCaml. That doesn't 
leave me with much confidence that I can figure out whether a particular
kind of mutual recursion is possible.:-|

I've seen various statements about recursion between modules being
impossible, but I'm not sure exactly how severe a limitation this is
in practice, especially given the possibility of hacks like the one
above.

In particular, I'm curious whether it's possible to define
a record type Foo which contains a functor-defined data structure which 
refer to objects of type Foo. E.g., in OCaml is there any way
to define a record type Foo one of whose fields is a Set of Foo?
If so, how? If not,
  * What's the recommended way to represent nontrivial interactions 
    between an object and other objects of the same type?
  * Is it possible to do this in any other strongly typed functional
    languages? And if not,
    ** Why not? Is it known to lead to undecidability or other
       horrendous problems, or is it not considered important, or is
       it an unsolved problem, or...

In general, I'd be interested in any pointers to treatments of this
problem and the theoretical limits involved. (Also the design
decisions involved: Why use "let rec" to combine functions and
"type ... and ..." to combine types and "class ... and ..." to combine
classes and so forth instead of some "rec ... end" or
"struct rec ... end" construct to make everything inside
mutually recursive?) I've spent some time with search engines and
"mutual recursion" and "recursion between modules" and "ml" and
"ocaml" and so forth, but I haven't stumbled on anything that really
nails it.

-- 
William Harold Newman <william.newman@airmail.net>
"Furious activity is no substitute for understanding." -- H. H. Williams
PGP key fingerprint 85 CE 1C BA 79 8D 51 8C  B9 25 FB EE E0 C3 E5 7C
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr


             reply	other threads:[~2001-11-22  2:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-11-22  1:53 William Harold Newman [this message]
2001-11-22  4:27 ` Brian Rogoff
2001-11-22  4:40   ` William Harold Newman
2001-11-29 20:04 Tom Hirschowitz

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=20011121195339.A24894@rootless \
    --to=william.newman@airmail.net \
    --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;
as well as URLs for NNTP newsgroup(s).