Previous week Up Next week


Here is the latest Caml Weekly News, for the week of April 15 to 22, 2008.

  1. Non-tail return
  2. unsigned 64-bit integer library
  3. is now ready to serve the OCaml community
  4. OCaml Summer Project decisions are in
  5. xsetxmap, unfunctorized, Sexp-lib aware versions of Set and Map
  6. Help needed for benchmarking OCaml on AMD64
  7. GODI Search

Non-tail return


Seo Sanghyeon announced:
Richard Jones suggested that type-safe return statement which
immediately returns from the innermost function would be useful. So I
developed an implementation. His sample code (from Extlib) works

Some notes:
* This depends on nontail exit patch I did as a part of break/continue
patch. break-continue-v2 was broken to break-continue-v3 and
* A stack of function's return type is maintained. "return e" causes
unification of "e" and return type on the top of the stack. "return e"
itself is typed as unit.
* Function is translated with implicit catch around body, and return
is translated to raise. Simplification removes implicit catch when no
return is used, so existing codes should compile same.

unsigned 64-bit integer library


Jeff Shaw announced:
If you would like to use C's unsigned long long type in ocaml, please try my
library. I've tested it only on Mac OS X ppc32, ocaml 3.10.x. Please let me
know about any modifications I should make; for instance, I don't know how to
make the library work in windows. Also I haven't tested storing UInt64.t in
hashtables much yet.

Quick instructions:
cd uint64lib
ocaml uInt64.cma
#install_printer UInt64.printer16;;
UInt64.of_string "0x123456789abcdef";; is now ready to serve the OCaml community


Stefano Zacchiroli announced:
** is ready!**

During the last few weeks, the Team, with the help of many other
members of the community, worked hard to fix a number of problems on the site.
Now we think it is ready for prime time. Therefore, following from the
previous announcement [1][2] of the availability of an OCaml planet and the
OCaml forge beta testing, we are now ready to allow full public access to
OCaml forge.


A forge is a set of services for software projects, including version
control systems (CVS, SVN, ...), mailing lists, download areas, bug
tracking systems, ... Well known examples are, GNA, and
Savannah. The forge for the OCaml community [3] will be specifically
aimed at hosting software projects related to the OCaml programming


This new forge has been beta tested, but you could still found some bugs.  In
this case, don't hesitate to submit bug to the Site Admin project [4]


So if you want to start an ocaml project on, sign-up
for an account on:

We want to limit the use of this forge to OCaml related project. This include
software or library written in OCaml, but also projects around OCaml, using
derived languages (JoCaml, OCamlDuce, ...) or providing service for OCaml
community (tools for conference organization...).

Help needed

At the moment, we have set up an hosting service for git and darcs
( and We are looking for
experienced forge administrator that can allow us to manage this two SCM
through GForge.  Contact us if you are interested.

We are also looking for talented web designer to make the look of nicer. Join the project ocamlcore-theme and read the
README file to know how to proceed...

the Team.
(Sylvain Le Gall, Romain Beauxis, Stefano Zacchiroli, Pietro Abate)

PS: you will find the classical LGPL with static linking exception
License at the end of the license list when you create your project

OCaml Summer Project decisions are in


Yaron Minsky announced:
And the project descriptions are up for your perusal. 

We chose 6 projects out of the more than 30 that we received this year. 
This page has links to the full text of the accepted proposals.

xsetxmap, unfunctorized, Sexp-lib aware versions of Set and Map


Berke Durak announced:
I decided to share my modification of the standard Set and Map modules.

Basically, I took Set and Map, unfunctorized them, passing the comparison
function as an optional argument with as the default, added
or exposed some missing functions (reverse_fold, reverse_iter, min_key...) and
added converters for Sexplib.

It is under LGPL and feel free to include it in Extlib, in Ocaml "batteries"
or anywhere else.
Jean-Christophe Filliâtre said and Berke Durak replied:
> Since your library is allowing the user to pass the comparison function 
> to any function which requires it 
>   type 'elt cp = 'elt -> 'elt -> int 
>   val add: ?cp:'elt cp -> 'elt -> 'elt t -> 'elt t 
>   val mem: ?cp:'elt cp -> 'elt -> 'elt t -> bool 
>   ... 
> you should really add a *huge* warning in the documentation saying that 
> it is unsound to insert an element with a comparison function and then 
> to search for it using another one. 
> This is precisely where the functor approach is increasing your program 
> correctness, with a static binding of a single comparison function into 
> the code of all operations. 
> Even without functors, you can provide a safer approach where the 
> comparison function is given when creating the data structure (a la Caml 
> light), and stored inside. This can be an optional argument of create 
> for instance, so that you keep your idea of a default comparison function: 
>         val create: ?cp:('elt -> 'elt -> int) -> unit -> 'elt t 
> (Note that I agree with you that it is sometimes annoying that Set and 
> Map do not provide polymorphic versions using, as 
> Hashtbl does with the polymorphic hash funtion. I'm only concerned with 
> the potential risk with your solution...)

Yes you are right, I should have put a warning. These modules are for peculiar
So here it is:

WARNING: The default comparison function is not sound for non-canonical
datastructures such as Sets and Maps. Xset is not canonical. Do not use Xsets
or Xmap without providing the correct comparison function. You must always
pass the same comparison function.

(That's why I was asking if there was a Set/Map structure with canonical
representation the other day.)

Extlib provides a version where the comparison function for the keys is stored
in the map.
But I chose to not do this for some peculiar reasons.
- I'm serializing Xmap and Xsets using Marshal, and I don't want to have
  functions in the structure
- I don't like the overhead of a wrapper structure and I don't want to
  complicate the API

Help needed for benchmarking OCaml on AMD64


Alain Frisch asked:
The new native dynamic linking feature requires some changes in the code 
generator for (non-Windows) AMD64 targets. Currently, this change is 
enabled by passing the -dlcode option to ocamlopt. A module which has 
not been compiled with this option cannot be dynlinked. 

Because -dlcode is only needed for AMD64 and it didn't exist before, 
most 3rd party libraries will likely not include this flag in their 
build system any time soon and they will thus be impossible to dynlink. 
This is not very satisfactory. 

A question to be answered before the release of OCaml 3.11 is whether 
this option should be enabled by default (and maybe provide another 
option to disable the new behavior). The only reason not to do so would 
be a degradation of performance. I haven't observed any difference on 
small benchmarks I did some months ago, but I'd like to collect more 
benchmarking data before enabling -dlcode by default. 

It would be great if some people could checkout the current CVS tree and 
try to compile and run their time-consuming programs with or without 
-dlcode on AMD64 systems, and report what they found out. I expect 
potential differences to appear only for functionally intensive code (a 
lot of inter or intra module function calls). To help benchmarking, the 
current CVS includes the following hack: if the environment variable 
OCAML_DLCODE is set to a non-empty value, ocamlopt behaves as if -dlcode 
were enabled. It is thus trivial to recompile (e.g. via GODI) any 3rd 
party library which your code may depend on. 

Any help will be appreciated!

GODI Search


Gerd Stolpmann announced:
I've just released a new feature on that is very
interesting for GODI and non-GODI users of O'Caml. It is a search engine
that allows you to search for identifiers and other words in an (almost)
full-blown GODI installation. I've developed this engine for the last
three weeks, and the results are already very interesting.

Just try it out here:

You can search for definitions of functions like "Hashtbl.fold", other
identifiers like "in_obj_channel", or just for "Xavier Leroy". The
search engine has some O'Caml parsing capabilities, and can e.g.
distinguish between value and type identifiers.

For the query syntax see

The syntax resembles Google's.

The engine is not yet perfect. A number of errors are listed in the FAQ

I would be glad to hear of more shortcomings - so I can fix or at least
document them soon. Feature wishes and other comments are also welcome.

Using folding to read the cwn in vim 6+

Here is a quick trick to help you read this CWN if you are viewing it using vim (version 6 or greater).

:set foldmethod=expr
:set foldexpr=getline(v:lnum)=~'^=\\{78}$'?'<1':1

If you know of a better way, please let me know.

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