From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id XAA23669; Sun, 11 Nov 2001 23:09:57 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id XAA23308 for ; Sun, 11 Nov 2001 23:09:56 +0100 (MET) Received: from fledge.watson.org (fledge.watson.org [204.156.12.50]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id fABM9sn08111 for ; Sun, 11 Nov 2001 23:09:55 +0100 (MET) Received: from localhost (patrick@localhost) by fledge.watson.org (8.11.6/8.11.5) with ESMTP id fABM9UT16150; Sun, 11 Nov 2001 17:09:30 -0500 (EST) (envelope-from patrick@watson.org) Date: Sun, 11 Nov 2001 17:09:29 -0500 (EST) From: Patrick M Doane To: "Marcin 'Qrczak' Kowalczyk" cc: caml-list@inria.fr Subject: Re: [Caml-list] A few questions regarding the compiler In-Reply-To: Message-ID: <20011111170005.F15236-100000@fledge.watson.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Sun, 11 Nov 2001, Marcin 'Qrczak' Kowalczyk wrote: > Sun, 11 Nov 2001 18:38:30 +0100, Xavier Leroy 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