Previous week Up Next week


Here is the latest Caml Weekly News, for the week of September 15 to 22, 2009.

  1. Generating comments from camlp4
  2. First public release of ULTRA type error slicer for SML
  3. OCaml-Java project: 1.3 release
  4. Other Caml News

Generating comments from camlp4


Alexey Rodriguez asked:
Is there a way to generate comments from camlp4 code?

We have preprocessors that generate the following kind of code in signatures:

>  <:sig_item<
>    $sig_generator the_type_declaration$;
>  >>

However, these extra function signatures show up in the output of
ocamldoc which is very annoying. We thought of using "ocamldoc stop"
tags (** / **), but we do not know how to generate such comments from
camlp4. Do you know of a way to do this:

>  <:sig_item<
>    (** / **)
>    $sig_generator the_type_declaration$;
>    (** / **)
>  >>

Comments are not part of the AST so I suppose we have to do some
hacking at the lexing level.

Note that having a dummy preprocessor that generates empty signatures
is not an option: this causes type checking errors that require a lot
of effort to circumvent.
He later added:
Just an update on the situation.

We are using Jane Street's excellent type_conv library to generate
code for user-defined types when preprocessing. However, these
generated functions appear in ocamldoc documentation and we would like
to avoid that. The easiest solution seemed to be to bracket the
generated code with stop tags: (** / **). In camlp4 comments are
tokens but I do not quite see how to generate tokens from camlp4
quotations. So at the moment I have the impression that I cannot solve
this problem at the camlp4 level.
Tiphaine Turpin suggested:
I just remembered that I once faced a similar problem. I solved it
rather easily using a custom documentation generator wich justs
redefines a few methods to discard the appropriate elements (those
starting with a n underscore in my case). Here is the code :

open Odoc_info
open Value

class my_doc_gen = object (this)
 inherit Odoc_html.html as super

 method synthetic name =
   (Name.simple name).[0] = '_'

 method html_of_attribute b a =
   if not (this#synthetic a.att_value.val_name)
   then super#html_of_attribute b a

 method html_of_method b a =
   if not (this#synthetic a.met_value.val_name)
   then super#html_of_method b a


let my_generator = new my_doc_gen
let _ = Odoc_args.set_doc_generator (Some (my_generator :>

First public release of ULTRA type error slicer for SML


Vincent Rahli and Joe Wells announced:
We are happy to announce the first public release of our type error
slicing software for the SML programming language.

All information can be found at this URL:

The aim of our type error slicer is to provide useful type error
reports for pieces of code written in SML.  Our type error slicer:

  * Identifies all of the program points that contribute to a type
    error (including the spot with the actual programming error that
    caused the type error),
  * Highlights these program points in the original, unchanged source
    code, and
  * Avoids showing internal details of the operation of the type
    inference machinery.

At the URL mentioned above, you can find a compiled package of the
software that is ready to be used.  The package contains:

  * Installation instructions and an installation shell script.
  * A compiled SML binary for Linux on the i386 architecture.  We
    have tested this on CentOS 5.3, Fedora 7, Ubuntu 9.04 and
  * Emacs Lisp code that extends GNU Emacs with commands that
    highlight source code with information about type error slices.
    We have tested this with GNU Emacs versions 22.1, 22.3 and 23.1.
  * A 19 page user guide containing detailed explanations of how to
    use the software and interpret the type error slices.
  * A very large number of sample test cases.

Known limitations:

  * We have not yet built the software for other operating systems
    than Linux.
  * The only currently supported user interface is via GNU Emacs (or
    our web demo).
  * Some features of the SML language are not parsed (the user will be
    notified if this is the case), and some type errors are not yet
    discovered (the user will need to rely on their usual type checker
    in these cases).  Notable spots where the implementation is
    incomplete are functors, overloading, equality types, and fixity
  * The details of the SML basis library are woefully incomplete
    (fortunately the user can add any additional details they are
  * The software does not currently scale well to very large programs
    (we are still improving this).  It is currently suitable for small
    programs and use in teaching.
  * We have some known issues with statuses of long identifiers
    and exceptions which yields wrong error reports.

There is also a web demonstration of the software with over 270 sample
test cases, so you can try without needing to install the software.

OCaml-Java project: 1.3 release


Xavier Clerc announced:
This post announces the 1.3 release of the OCaml-Java project.
The goal of the OCaml-Java project is to allow seamless integration of OCaml
and Java.

Home page:
Download page:
Toplevel applet:

Main changes since 1.2:
 - upgrade from version 3.11.0 to 3.11.1
 - experimental support for debugger (only manual mode / no backward
 - experimental support for 'labltk' library (based on Jacl [1] / Swank [2])
 - bug #38: wrong interpretation of CLASSPATH meta
 - bug #42: camlp4 and cmxs files
 - bug #43: marshalling of dynlinked closure
 - bug #44: better message for ScriptException

Other Caml News

From the ocamlcore planet blog:
Thanks to Alp Mestan, we now include in the Caml Weekly News the links to the
recent posts from the ocamlcore planet blog at

Medoc documentation system:

OCaml cryptokit and Java PBEWithMD5AndDES:

OCaml-R 0.1:

Old cwn

If you happen to miss a CWN, you can send me a message and I'll mail it to you, or go take a look at the archive or the RSS feed of the archives.

If you also wish to receive it every week by mail, you may subscribe online.

Alan Schmitt