caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jacques GARRIGUE <garrigue@kurims.kyoto-u.ac.jp>
To: Alain.Frisch@ens.fr
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Proposal for separate compilation
Date: Fri, 28 May 2004 10:54:27 +0900 (JST)	[thread overview]
Message-ID: <20040528.105427.68533454.garrigue@kurims.kyoto-u.ac.jp> (raw)
In-Reply-To: <Pine.SOL.4.44.0405280222170.28426-100000@clipper.ens.fr>

From: Alain Frisch <Alain.Frisch@ens.fr>

> On Wed, 26 May 2004, Xavier Leroy wrote:

> > There is one thing that puzzles me in your proposal.  Consider two
> > compilation units A and B, where B refers to A.
> >...
> > So, what unique identifier is B going to use to refer to A's definition?
> > Since A.cmi is the only available info on A, that
> > identifier must be tied to A.cmi: either a hash of A's interface, or
> > some unique identifier generated when A.mli is compiled into A.cmi.
> 
> If I understand the point correctly, an example would two modules
> MyString1 and MyString2, with myString1.mli == myString2.mli:
> 
> type t = string
> val compare: t -> t -> unit
> 
> but different implementations. One solution is simply, as Nicolas
> suggests, to store the original name of the compilation unit in the uid.
> Still, one could imagine two modules with the same name and the same
> interface in unrelated libraries. This would be a good argument for using
> reallly unique ids instead of hash. When you compile an interface a.mli,
> you just mark a.cmi with a fresh random uid (with possibly a check that
> the real content of a.cmi has been modified, otherwise don't touch the
> uid). This will be used to make reference to module A from b.cmo (and of
> course a.cmo). In other words: compilation of interfaces is given a
> generative semantics.

Yes, but by doing that you are breaking two things:
* a .cmi does no longer depend only on the contents of the .mli
  i.e., if you recompile twice the same library, then all the
  dependencies must be recompiled, eventhough nothing has changed
  (This may make bootstrapping the compiler rather complicated!
   Every recompilation of the standard library would be incompatible.)
* one can imagine a strange situation where you generated two
  differents .cmo with the same .cmi (i.e. two .ml for one .mli, and
  you compiled the .mli only once). Your scheme cannot cope with this
  case: the two .cmo would conflict.
  (I agree this is a bit far fetched)

The bootstrapping problem may be a show-stopper.
 
> Since you mention the generation of the unique identifier, I guess I
> missed something.

This looks like an attempt to solved the above compatibility problem.
Do not change the semantics of interfaces, only the compilation of
implementation.
Both imports and exports of libraries have "abstract" names (in
practice unique ids, different for import and export) and the linker
connects imports to the corresponding exports. Sound pretty powerful,
and theoretically nice. But you get bigger .cmo/.cmx, and linking is
more complex.

Jacques

-------------------
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


  reply	other threads:[~2004-05-28  1:54 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-21 16:32 Alain Frisch
2004-05-21 18:11 ` Richard Jones
2004-05-21 18:27 ` Nicolas Cannasse
2004-05-26  8:32 ` Xavier Leroy
2004-05-26 15:12   ` Nicolas Cannasse
2004-05-28  0:33   ` Alain Frisch
2004-05-28  1:54     ` Jacques GARRIGUE [this message]
2004-05-28  7:13       ` Nicolas Cannasse
2004-05-28  9:55       ` Alain Frisch
2004-05-28 10:14         ` Christian Lindig

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=20040528.105427.68533454.garrigue@kurims.kyoto-u.ac.jp \
    --to=garrigue@kurims.kyoto-u.ac.jp \
    --cc=Alain.Frisch@ens.fr \
    --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).