From: Judicael Courant <Judicael.Courant@ens-lyon.fr>
To: monniaux@csl.sri.com
Cc: stodghil@cs.cornell.edu, caml-list@pauillac.inria.fr
Subject: Re: Managing module names
Date: Thu, 24 Jul 1997 16:36:54 +0200 (MET DST) [thread overview]
Message-ID: <199707241436.QAA02795@chianti.ens-lyon.fr> (raw)
In-Reply-To: <199707222345.QAA07214@tulip.csl.sri.com> (message from David Monniaux on Tue, 22 Jul 1997 16:45:26 -0700 (PDT))
[Version francaise ci-dessous]
>
>Concerning the module namespace:
>as far as I know, Java uses some mapping of the namespace onto the
>filesystem, allowing easy filing of libraries.
>
>Caml has a hierarchized modules system, but only allows toplevel
>modules to be mapped into files.
>
>Would it be possible to make up some scheme that would to things like:
>/graphics/blackwhite/main -> Graphics.Blackwhite.Main ?
>
I think there is a real problem for dealing with module namespace, but
I do not like this solution, because I may have a file
/graphics/blackwhite/debug.cmo that I do not always want to open. More
generally, I think that the interaction between the language and the
filesystem should be kept as small as possible.
Rather, I would prefer a small utility (let's say ocamllib) grouping
together a bunch of .cmo or .cmi files.
For instance assume a.ml contains
let x = 1
and b.ml contains
let x = A.x
then "ocamllib A.cmo B.cmo -o C.cmo" would give the same file C.cmo as
the compilation of the following C.ml :
module A =
struct
let x = 1
end
module B =
struct
let x = A.x
end
Of course, "ocamllib" should also apply in the same way to .cmi files.
There is then a clear distinction between the filesystem hierarchy and
the language constructs. And if you wish to, you could perfectly add
to your makefiles a rule such as
%.cmi: %
ocamllib $*/*.cmi -o $*.cmi
IMHO, this mecanism would be a good replacement for the existing -a
option of ocamlc.
Also, I guess that implementing ocamllib is much simpler than
taking advantage of the filename hierarchy.
[English version above]
>
>[En Francais: pourquoi ne pas profiter du systeme de fichiers pour
>rendre plus souple l'usage de la hierarchie de modules?]
Il me semble que le besoin d'une gestion plus elabore de la hierarchie
des modules est reel, mais je preferais une autre solution, plus
independante du systeme de fichier.
On pourrait imaginer un utilitaire "ocamllib" capable de grouper des
.cmi ou des .cmo.
Ainsi, si a.ml contient
let x = "quel dommage que le francais ne soit pas la langue
internationale !"
et b.ml contient
let x = A.x
alors "ocamllib -o C.cmo A.cmo B.cmo" produirait un fichier C.cmo
identique a celui qu'aurait produit la compilation d'un fichier C.ml
contenant :
module A =
struct
let x = "quel dommage que le francais ne soit pas la langue
internationale !"
end
module B =
struct
let x = A.x
end
Mutatis mutandis pour les .cmi
De cette facon, on a une solution assez independante du systeme de
fichier employe, probablement plus efficace et plus simple a
implanter. Par ailleurs, rien n'empeche d'ecrire dans son Makefile une
ligne du type
%.cmi: %
ocamllib $*/*.cmi -o $*.cmi
Judicael.
--
Judicael.Courant@ens-lyon.fr, http://www.ens-lyon.fr/~jcourant/
tel : (+33) 04 72 72 85 82
<< Heureux ceux qui savent rire d'eux memes :
Ils n'ont pas fini de s'amuser ! >>
next prev parent reply other threads:[~1997-07-24 15:07 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
1997-07-22 14:19 Paul Stodghill
1997-07-22 23:45 ` David Monniaux
1997-07-23 12:29 ` Paul Stodghill
1997-07-24 14:36 ` Judicael Courant [this message]
1997-07-24 5:21 Frank Christoph
1997-07-25 13:56 ` Fabrice Le Fessant
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=199707241436.QAA02795@chianti.ens-lyon.fr \
--to=judicael.courant@ens-lyon.fr \
--cc=caml-list@pauillac.inria.fr \
--cc=monniaux@csl.sri.com \
--cc=stodghil@cs.cornell.edu \
/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