English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
[Caml-list] Questions about #use
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2002-02-09 (08:52)
From: Harrison, John R <johnh@i...>
Subject: [Caml-list] Questions about #use
The documentation for the "#use" directive says "phrases are processed just
as if they were typed on standard input". However according to my
experience with OCaml, this isn't really accurate. Some level of syntax
checking is first done on the whole file before any phrases are processed.
For example, a syntax error on the last line will prevent any phrases from
being fully processed.

I'd like a function that does indeed display the behaviour implied by the
documentation, i.e. handles the toplevel phrases successively. Is this
easily done?

I would also like to be able to issue an analogous directive dynamically
(e.g. to read files from a program-specific search path). Since "#use"
isn't a CAML value, I can't use it. Digging around in the sources I came up
with the following, which seems to work:

  Toplevel.use_file Format.std_formatter <filename>

However, I didn't find any means of doing dynamic loading of source
mentioned in the documentation. Is the above safe or is something else

Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr