caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: brogoff <brogoff@speakeasy.net>
To: Tony Edgin <edgin@slingshot.co.nz>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Circular module dependencies
Date: Mon, 6 Sep 2004 21:39:21 -0700 (PDT)	[thread overview]
Message-ID: <Pine.LNX.4.58.0409062132170.32038@shell2.speakeasy.net> (raw)
In-Reply-To: <200409070917.18022.edgin@slingshot.co.nz>

On Tue, 7 Sep 2004, Tony Edgin wrote:

> Hi all.
>
> Recently, there was a thread which talked about how difficult module
> dependencies were to resolve for linking in Ocaml.  I'm guessing this is
> because of cycles in the dependency graph.
>
> My thought is that maybe Ocaml shouldn't allow this to happen.  Wouldn't
> cyclical module dependencies be a symptom of bad design?  If a cyclic
> dependency occurs I can think of two ways of removing.
>
> First, if the dependency is among modules which are closely related, the code
> in each module in the cycle which interacts, should be extracted into its own
> module.   The cycle indicates code which is semantically related and would
> probably be easier to understand if it were all contained in the same file
> anyway.

In a discussion on this topic a while back, Fergus Henderson cited as an
example the Mercury compiler, where removing the dependencies by making one
big file of the dependent parts would lead to a pretty large file. I thought
that was a decent argument in favor of allowing mutually recursive functions
to cross module boundaries.

Another good example is when you have programs written in functorized style
(eg the Set module in OCaml) and you want to define a type which is in a
recursive relationship with the functor instantiation.

There are workarounds for those cases, but I think it's fair to say that
the desire for some recursive module capability is not always on account of
bad design.

-- Brian

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


  parent reply	other threads:[~2004-09-07  4:39 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-07  9:17 Tony Edgin
2004-09-07  2:28 ` Jacques GARRIGUE
2004-09-07 17:10   ` Christopher Dutchyn
2004-09-07  4:39 ` brogoff [this message]
2004-09-07  6:12   ` Erik de Castro Lopo
2004-09-07 12:36     ` brogoff
2004-09-07 13:39       ` Christopher A. Watford
2004-09-08  0:30       ` Erik de Castro Lopo
2004-09-07  6:14 ` Nicolas Cannasse

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=Pine.LNX.4.58.0409062132170.32038@shell2.speakeasy.net \
    --to=brogoff@speakeasy.net \
    --cc=caml-list@inria.fr \
    --cc=edgin@slingshot.co.nz \
    /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).