Previous week Up Next week


Here is the latest OCaml Weekly News, for the week of June 17 to 24, 2014.

  1. Core Suite 111.17.00
  2. OCaml release 4.02.0+beta1
  3. Other OCaml News

Core Suite 111.17.00


Ben Millwood announced:
I am pleased to announce the (somewhat delayed) 111.17.00 release of
the Core suite.

The following packages were upgraded:

- async
- async_extra
- async_inotify
- async_kernel
- async_parallel
- async_unix
- bignum
- core
- core_extended
- core_kernel
- faillib
- jenga
- ocaml_plugin
- patdiff
- patience_diff
- sexplib
- typerep

We're also releasing for the first time a new library called
async_extended, which contains more experimental and less
well-scrutinised code than async, in much the same role that
core_extended plays for core.

Note that async_extra, despite the name, does not play that role: the
code in async_extra is subject to the same level of scrutiny as async
or async_kernel. We've had discussions internally about merging async
and async_extra into a single library, since they serve essentially
the same purpose, but it's no-one's top priority.

Files and documentation for this release are available on our website
and all packages are in opam:

Here is the list of changes for this version:

## async_extra

- Added module `Persistent_rpc_client`, an RPC client that attempts to
reconnect when the connection is lost, until a new connection is
- Significantly sped up the `Rpc` module by removing `Bigstring`

Performance of the two implementations was tested by building a
simple client/server executable that would count major cycles.
Sending 100 byte messages at a rate of 50k/second shows (on both
sides of the RPC):

* ~160 major cycles in 30s
* CPU usage around 60%

* ~10 major cycles in 30s
* CPU usage <= 2%
- Enabled a version of `Pipe_rpc` and `State_rpc` where the consumer
can pushback on the producer if it can't consume the contents of the
pipe fast enough.
- Added `Log.Level.arg : Log.Level.t Command.Spec.Arg_type.t` for
defining command lines that accept (and autocomplete) log levels.
- Added `Command.async_or_error` and renamed `Command.async_basic` to
`Command.async`, leaving `async_basic` a deprecated alias for the
new name.

`Command.async_or_error` is similar to `Command.basic` and
`Command.async`, but accepts a `unit Or_error.t Deferred.t` type.
- Added `Persistent_rpc_connection.current_connection`, so that one
can detect whether one is currently connected.

val current_connection : t -> Rpc.Connection.t option

## async_inotify

- Upgraded library to use inotify 2.0

## async_kernel

- Renamed `Monitor.errors` to `Monitor.detach_and_get_error_stream`
and `Monitor.error` as `Monitor.get_next_error`.

The use of `detach` in the name is intended to make clear that
errors do not propagate to the parent.

Added several other non-stream =Monitor= functions to capture common
use cases of `Monitor.detach_and_get_error_stream`:


## bignum

- Improved the performance of binprot deserialization by removing the
allocation of an intermediate type.

## core

- Fixed a bug in `Bigstring.really_recv` if `recv` doesn't receive all
the data it wants.

This bug has been around forever; it may not have caused trouble
because `Bigstring.really_recv` (1) is barely used (the only use is
in `Bigstring.unmarshal_from_sock`) and (2) passes `recv` the
`MSG_WAITALL` flag, so it will read the full amount unless it gets
interrupted by a signal.
- Fixed ``'s handling of `EINTR` so that it retries
rather than returning zero.

This fixes a bug introduced in 111.09 in the interaction between
`` and `Async.Reader`. Prior to 111.09,
`` would raise on `EINTR`, and `Async.Reader` would
propagate the exception. From 111.09 to 111.16, ``
would return zero, which would confuse `Async.Reader` into thinking
it reached EOF when it hadn't. From 111.17, `` will
retry and not return zero when not at EOF.

We believe the bug was rare, because otherwise we would have
frequently seen `EINTR` exceptions prior to 111.09.
- Added `Command.Spec.apply` and `pair`, which allow one to program
more with `Spec.param` rather than `Spec.t`.

val apply : ('a -> 'b) param -> 'a param -> 'b param
val pair : 'a param -> 'b param -> ('a * 'b) param
- Added `Command.Spec.file`, which builds an `Arg_type` value with the
same autocompletion as `Spec.file`.

(** [file] defines an [Arg_type.t] that completes in the same way as
[Command.Spec.file], but perhaps with a different type than [string]
or with an
autocompletion key. *)
val file
: ?key:'a Univ_map.Multi.Key.t
-> (string -> 'a)
-> 'a t

## core_extended

- Added some functions to `Splay_tree`:
* `length`
* `keys`
* `data`
* `to_alist`
* `delete_{after,before}`
* `map`
* `map_range`
* `split`.

## core_kernel

- In `Bigstring`, made many operations use compiler primitives new in
OCaml 4.01.

Exposed `Bigstring.get` and `set` as compiler primitives in the

Added `Bigstring.unsafe_get_int64_{le,be}_trunc`.
- Made `Error` round trip `exn`, i.e. `Error.to_exn (Error.of_exn exn)
= exn`.
- Added to `failwiths` an optional `?here:Lexing.position` argument.
- Added `with typerep` to `Flags.S`.
- Optimized `List.dedup []` to return immediately.
- Added `data` argument to polymorphic type

This allows implementations of `Hashtbl_intf.Creators` to have
constructor arguments that depend on the type of both key and data
values. For example:

module type Hashtbl_creators_with_typerep =
with type ('key, 'data, 'z) create_options
= typerep_of_key:'key Typerep.t
-> typerep_of_data:'data Typerep.t
-> 'z
- Improved the interface for getting `Monad.Make` to define `map` in
terms of `bind`.

Instead of passing a `map` function and requiring everyone who wants
to define `map` using `bind` to call a special function, we use a
variant type to allow the user to say what they want:

val map : [ `Define_using_bind
| `Custom of ('a t -> f:('a -> 'b) -> 'b t)
- Improved the performance of many `Dequeue` functions.

Previously, many `Dequeue.dequeue`-type functions worked by raising
and then catching an exception when the dequeue is empty. This is
much slower than just testing for emptiness, which is what the code
now does.

This improves the performance of `Async.Writer`, which uses

## patdiff

- Removed latex output.

## patience_diff

- Exposed `Patience_diff.matches`.

## sexplib

- Make the camlp4 dependency optional


We hope you find it useful!

-- Ben Millwood, on behalf of the Core team

OCaml release 4.02.0+beta1


Continuing this thread, Anil Madhavapeddy announced:
To help with testing and OPAM bulk builds, there's now an Ubuntu PPA
that tracks the 4.02.0dev snapshots of OCaml with binary packages.

There's also a binary package of a minor revision of OPAM (version
1.1.2) whose only change is to tweak the build system to compile
without camlp4, thus letting it work with the out-of-the-box OCaml

This PPA will only last as long as the 4.02.0dev cycle, and when the
stable version is released, it will have a permanent home following
the same scheme as the other repositories on

Other OCaml News

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

Highlights from recent sessions:

Sixth OCaml compiler hacking session:

Cartesian product:

OCaml EFL 1.10.0 released:


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