From: Michael <michipili@gmail.com>
To: "Daniel Bünzli" <daniel.buenzli@erratique.ch>,
"Anil Madhavapeddy" <anil@recoil.org>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Re: Opening a module from toploop startup
Date: Sun, 14 Jul 2013 20:23:37 +0200 [thread overview]
Message-ID: <51E2ECA9.4070203@gmail.com> (raw)
In-Reply-To: <572AABCBE61A44C0B2CF24F9B03CBEDC@erratique.ch>
Hi Daniel, Hi Anil,
thank you very much for your very useful answers, they helped a lot!
I could have a look at them today, and I studied in more details the
toplevel code, and since the startup hook is processed before that the
toplevel has been initialised, it is probably not a good place to open
modules:
let main () =
Arg.parse Options.list file_argument usage;
if not (prepare Format.err_formatter) then exit 2;
Toploop.loop Format.std_formatter
let loop ppf =
fprintf ppf " OCaml version %s@.@." Config.version;
initialize_toplevel_env ();
…
let prepare ppf =
Toploop.set_paths ();
try
let res =
List.for_all (Topdirs.load_file ppf) (List.rev !preload_objects) in
!Toploop.toplevel_startup_hook ();
res
with x ->
…
A better place to open these modules is probably the initialisation file.
The example of the “core-runner-toplevel” shows well how to write an
alternate toplevel, I will probably found it very useful when I will
need more substantial amenagements.
Regards,
Michael
next prev parent reply other threads:[~2013-07-14 18:24 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-01 21:30 [Caml-list] " Michael Le Barbier Grünewald
2013-07-09 9:26 ` [Caml-list] " Michael
2013-07-09 9:33 ` Daniel Bünzli
2013-07-14 18:23 ` Michael [this message]
2013-07-09 9:36 ` Anil Madhavapeddy
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=51E2ECA9.4070203@gmail.com \
--to=michipili@gmail.com \
--cc=anil@recoil.org \
--cc=caml-list@inria.fr \
--cc=daniel.buenzli@erratique.ch \
/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