caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Patrick M Doane <patrick@watson.org>
To: "Marcin 'Qrczak' Kowalczyk" <qrczak@knm.org.pl>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] A few questions regarding the compiler
Date: Sun, 11 Nov 2001 17:09:29 -0500 (EST)	[thread overview]
Message-ID: <20011111170005.F15236-100000@fledge.watson.org> (raw)
In-Reply-To: <slrn9utssh.cck.qrczak@qrnik.zagroda>

On Sun, 11 Nov 2001, Marcin 'Qrczak' Kowalczyk wrote:

> Sun, 11 Nov 2001 18:38:30 +0100, Xavier Leroy <xavier.leroy@inria.fr> pisze:
>
> > Not easily.  You could link with the toplevel and call
> > "Toploop.use_silently" to execute code from a file, suppressing
> > the output.
>
> I looked closer and realized that it's quite impossible to plug into
> toplevellib something other than the default Topmain, although it's
> very close to being possible.
>
> For example the Clflags module is not exported (i.e. clflags.cmi
> is not installed) so I can't set any options. Initialization is
> hardwired into Toploop.loop, but calling Toploop.loop is too much:
> it reads from stdin (which must be available to the program so it
> can't be /dev/null) and writes to stdout. Initializing by hand is
> not possible because the relevant modules are not exported.

See my implementation of Fort which works around some of these issues. For
example, initialization is also hardwired into "run_script" so we can it:

  let save_arg = Sys.argv.(0) in
  Sys.argv.(0) <- "__dummy";
  let ignore_formatter =
    Format.make_formatter (fun _ _ _ -> ()) (fun _ -> ()) in
  ignore (Toploop.run_script ignore_formatter "__dummy" Sys.argv);
  Sys.argv.(0) <- save_arg

> I don't want to have to compile a custom OCaml version - it should
> work with whatever is installed with OCaml. Unfortunately now it's
> impossible.

I agree that the top-level interface should be improved. I've been able to
find workarounds so far, but it sounds like you have some issues that
require some definite changes.

Another gripe of mine is that Topdirs.dir_load does not print good
diagnostic information when it fails, so in practice I create a dummy
script containing a single "#load" directive to get the error messages to
display properly.

Patrick

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


  reply	other threads:[~2001-11-11 22:09 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-10-29 15:43 Marcin 'Qrczak' Kowalczyk
2001-11-11 17:38 ` Xavier Leroy
     [not found] ` <9smdf7$511$1@qrnik.zagroda>
2001-11-11 21:54   ` Marcin 'Qrczak' Kowalczyk
2001-11-11 22:09     ` Patrick M Doane [this message]
2001-11-13 20:36     ` Xavier Leroy
     [not found]     ` <9ssfsl$fa4$1@qrnik.zagroda>
2001-11-14  3:03       ` Marcin 'Qrczak' Kowalczyk
2001-11-14  9:52         ` Markus Mottl
2001-11-14 13:20         ` David Mentre
     [not found]         ` <9sttmn$kei$1@qrnik.zagroda>
2001-11-14 14:47           ` Marcin 'Qrczak' Kowalczyk
2001-11-14 16:45             ` Marcin 'Qrczak' Kowalczyk

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=20011111170005.F15236-100000@fledge.watson.org \
    --to=patrick@watson.org \
    --cc=caml-list@inria.fr \
    --cc=qrczak@knm.org.pl \
    /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;
as well as URLs for NNTP newsgroup(s).