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
Module hierarchies
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2001-01-08 (17:49)
From: Judicael Courant <Judicael.Courant@l...>
Subject: Re: Module hierarchies
Xavier Leroy a écrit :
> I still have no idea how hard it is to implement Judicaël's scheme,
> though.

What about the following idea (close to Vitaly Lugovsky's suggestion):

- the name of a compilation_unit would be a string list instead
  of a string.

- ocamlnewmagiccommand -o lib.cma a.cmo b.cmo c.cmo
  would rename the name of "A", "B" and "C" to [ "Lib" ; "A" ],
  [ "Lib" ; "B" ] and [ "Lib" ; "C"], would compile a small with contents "module A = A;; module B = B;; module
  C=C;;" into lib.cmo and would replace references of
  a.cmo, b.cmo, c.cmo and lib.cmo to A, B, C by references to
  ["Lib"; "A" ], [ "Lib"; "B" ], [ "Lib"; "C" ].
  Then, it would just pack together these modules into one
  single library.

I am not really familiar with ocamlc source code but from what I can
read in bytecode/emitcode.mli, I guess implementing the two needed
operations (renaming a compilation unit and renaming some references of
a compilation unit to other compilation units) would be quite easy. Did
I miss anything ?

(+33) (0)1 69 15 64 85
"Montre moi des morceaux de ton monde, et je te montrerai le mien"
Tim, matricule #929, condamné à mort.