Three new packages - ocaml-pa-do, ocaml-p3l, coccinelle

Richard W.M. Jones rjones at
Wed Mar 18 10:09:22 UTC 2009

Just a note to say that I've added three superb new OCaml packages:

*** ocaml-pa-do is a syntax extension which provides "delimited
overloading" of operators.  In plain English, "operator overloading"
lets you overload operators, such as using "+" to mean addition of
complex numbers or vectors.  Traditionally this has been regarded as
potentially dangerous in OCaml.  Which is why this extension is
"delimited", meaning that sections of code where operator overloading
is permitted are clearly marked.

For example:

let z' =
  Complex.(                     <-- the delimiter
    log(z + 2I) = I / u         <-- overloaded complex number expression

let bi =
    23 ** 567 mod 45 + "123456789123456789123456789"

You can add your own overloading using the pa_do API.  pa_do comes
with overloadings for many existing integer types in OCaml.

*** ocaml-p3l is a parallel skeleton programming compiler.  This
allows you to model the parallel aspects of your program using
templates such as MapReduce.  It can then generate code which
transparently distributes itself both across clusters of machines, and
over multiple cores in a single machine.

OCamlP3L programs also have a deterministic, sequential interpretation
which allows you to prove properties of the program.

*** Finally coccinelle (spatch) is a framework for semantic patching
of Linux kernel code.  Semantic patches describe changes to code in
terms of C expressions:

expression lock, flags;       <-- this is "any C expression" bound
expression urb;               <-- to lock/flags/urb

  spin_lock_irqsave(lock, flags);
- usb_submit_urb(urb)
+ usb_submit_urb(urb, GFP_ATOMIC)
  spin_unlock_irqrestore(lock, flags);

expression urb;

- usb_submit_urb(urb)
+ usb_submit_urb(urb, GFP_KERNEL)


Richard Jones, Emerging Technologies, Red Hat
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine.  Supports Linux and Windows.

More information about the Fedora-ocaml-list mailing list