Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] Proposal for separate compilation
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-05-28 (07:14)
From: Nicolas Cannasse <warplayer@f...>
Subject: Re: [Caml-list] Proposal for separate compilation
> > 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
> > 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.)

That's why I'm suggesting we should still use a hash of the cmi as uid, and
add a random id in order to resolve ambiguous cases only.

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

This is clearly forbidden by both current and "improved" linking model, I'm
not sure we want that "feature" :)

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

This is also a solution, but as you told, it's more complex to implement.
I'm worried also about this complexness when using Dynamic linking . Alain's
idea - still not perfect - is simple enough to be worth implemented.

Best Regards,
Nicolas Cannasse

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: