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 SAA17472; Sun, 11 Nov 2001 18:38:48 +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 SAA17094 for ; Sun, 11 Nov 2001 18:38:47 +0100 (MET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id fABHcVn04114; Sun, 11 Nov 2001 18:38:31 +0100 (MET) Received: (from xleroy@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id SAA17399; Sun, 11 Nov 2001 18:38:30 +0100 (MET) Date: Sun, 11 Nov 2001 18:38:30 +0100 From: Xavier Leroy To: "Marcin 'Qrczak' Kowalczyk" Cc: caml-list@inria.fr Subject: Re: [Caml-list] A few questions regarding the compiler Message-ID: <20011111183830.A13429@pauillac.inria.fr> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0i In-Reply-To: ; from qrczak@knm.org.pl on Mon, Oct 29, 2001 at 03:43:01PM +0000 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > 1. Is it possible to setup a custom handler / printer of exceptions > raised at the toplevel? The language defines how to convert objects > to strings but of cource OCaml doesn't know that when printing > exceptions. In 3.03 alpha and in the forthcoming 3.03, additional "hooks" were added to the toplevel so that it can call user-provided functions for displaying evaluation results, including uncaught exceptions. The Camlp4 preprocessor makes good use of this new feature. > 2. Why ocamlc & ocamlopt are compiled to bytecode and ocamlc.opt & > ocamlopt.opt have these names instead of being the default? Largely because the native-code compiler is not always available. Also, the main purpose of the .opt compilers is to test the ocamlopt compiler by bootstrapping it. Unless your source code is very large, or your machine very slow, the regular ocamlc and ocamlopt are reasonably fast already. > 3. I will want to have an interactive interpreter for my language, > in addition to a compiler of standalone executables. > > I think it should be possible to start ocaml (or a custom toplevel) > in a subprocess and talk with it through a pipe, giving it > declarations compiled on the fly. It can be done this way indeed, although again Camlp4 provides another alternative where your preprocessor and the Caml toplevel live in the same process. > How to suppress printing the > prompt and the resulting value and type? Not easily. You could link with the toplevel and call "Toploop.use_silently" to execute code from a file, suppressing the output. > Is there a better way? This one probably won't work on Windows. The pipe thing can be made to work under Windows, however there is an issue with interrupting a looping inferior OCaml process. We're working on this for 3.03. > 4. Am I right that modules are executed exactly in the order provided > during linking, and that the only requirement is that each module > is listed after those it depends on? Yes, exactly. - Xavier Leroy ------------------- 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