caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Xavier Leroy <xavier.leroy@inria.fr>
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 18:38:30 +0100	[thread overview]
Message-ID: <20011111183830.A13429@pauillac.inria.fr> (raw)
In-Reply-To: <slrn9tqu81.1ht.qrczak@qrnik.zagroda>; from qrczak@knm.org.pl on Mon, Oct 29, 2001 at 03:43:01PM +0000

> 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


  reply	other threads:[~2001-11-11 17:38 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 [this message]
     [not found] ` <9smdf7$511$1@qrnik.zagroda>
2001-11-11 21:54   ` Marcin 'Qrczak' Kowalczyk
2001-11-11 22:09     ` Patrick M Doane
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=20011111183830.A13429@pauillac.inria.fr \
    --to=xavier.leroy@inria.fr \
    --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).