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: Tue, 13 Nov 2001 21:36:57 +0100	[thread overview]
Message-ID: <20011113213657.B24821@pauillac.inria.fr> (raw)
In-Reply-To: <slrn9utssh.cck.qrczak@qrnik.zagroda>; from qrczak@knm.org.pl on Sun, Nov 11, 2001 at 09:54:25PM +0000

> > 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.
> 
> Only toplevel? I would like to have it in standalone executables.

For standalone executables, it is very easy to wrap your generated
program in a catch-all "try...with" construct, and print the escaping
exception as you see fit.

> I don't see how Camlp4 could help. The compiler is not written in
> OCaml, it only generates OCaml output.

Camlp4 (among other features) provides an easy way to construct OCaml
abstract syntax trees and have then compiled or executed by the OCaml
compilers or toplevel.  It exploits a number of hooks in the compilers
and toplevel to achieve fairly tight integration with them.  So, I'm
pretty sure it could help, provided your compiler is written in OCaml
indeed.

> [toplevel interface not doing what you want]
> I don't want to have to compile a custom OCaml version - it should
> work with whatever is installed with OCaml.

Methinks you're asking for too much here :-)

> Another question. Low-level libraries for my language contain many
> embedded OCaml snippets written by hand, so they often contain errors.
> Is it possible to tell the OCaml compiler about original source
> positions for parts of the program, so it reports them in error
> messages? I mean like '# line_no "filename"' in cpp. Maybe Camlp4
> could help?

The ocamlc and ocamlopt compilers honor '# lineno "filename"'
directives.

> Yet another question. OCaml doesn't accept an identifier as the
> rhs of let rec (an identifier defined earlier). Why? I had to make
> a little workaround to not generate such bindings. I guess it's the
> only difference between "what is accepted in let rec" and "what allows
> generalization of free type variables"?

IIRC, the reason was that this offered no increase in expressive
power, yet would require a nasty special case in the compilation
scheme for "let rec" definitions.

- 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


  parent reply	other threads:[~2001-11-13 20:37 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
2001-11-13 20:36     ` Xavier Leroy [this message]
     [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=20011113213657.B24821@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).