[Libguestfs] Minimum OCaml compiler version

Richard W.M. Jones rjones at redhat.com
Sun Sep 24 15:02:33 UTC 2017


Currently it's OCaml >= 3.11
(http://libguestfs.org/guestfs-building.1.html#full-list-of-requirements).

That was chosen because it is the version of OCaml in RHEL 6.  But
actually libguestfs isn't compilable on RHEL 6 because the version of
yajl is too old (there are probably other issues too, but that's the
first one I came up against).

Can we choose a new minimum version?  There are a lot of interesting
features in OCaml that we might want to use, in particular:

 - Make use of Bytes unconditional.  Requires OCaml >= 4.02.

 - PPX extension points could be used to generate repetitive
   string_of_* functions.  (OCaml >= 4.02)

 - ‘match’ can catch exceptions. (OCaml >= 4.02,
   https://blog.janestreet.com/pattern-matching-and-exception-handling-unite/)

 - Record fields and variant constructors can have the same name and
   the compiler sorts out the right struct/type intelligently.
   (OCaml >= 4.01,
   http://www.lexifi.com/blog/type-based-selection-label-and-constructors)

 - GADTs and first class modules allow more "sophisticated" used of
   modules, although I tend to think that these will just make the
   code more confusing so I would push back on people trying to use if
   they were being too clever.  (OCaml >= 3.12 and especially >= 4.00
   https://forge.ocamlcore.org/docman/view.php/77/112/leroy-cug2010.pdf
   https://ocaml.org/meetings/ocaml/2012/slides/oud2012-leroy-slides.pdf)

Also it would be nice to reduce the number of warnings, especially
about the new "noalloc" syntax:

  File "common_utils.ml", line 26, characters 0-85:
  Warning 3: deprecated: [@@noalloc] should be used instead of "noalloc"

Versions of OCaml in various major distributions:

  Arch (AUR)                   OCaml 4.05
  Debian 8 (oldstable, jessie) OCaml 4.01
  Debian 9 (stable, stretch)   OCaml 4.02
  Debian 10 (testing, buster)  OCaml 4.02
  Fedora 25                    OCaml 4.02
  Fedora 26                    OCaml 4.04
  Fedora 27, 28                OCaml 4.05
  OpenSUSE (all versions)      OCaml 4.05
  RHEL <= 7.4                  OCaml 4.01
  RHEL >= 7.5                  OCaml 4.05
  Ubuntu 14.04                 OCaml 4.01
  Ubuntu 16.04                 OCaml 4.02
  Ubuntu Zesty                 OCaml 4.02
  Ubuntu Artful                OCaml 4.04

Since most of the new, interesting features were added in OCaml 4.02,
that would be my choice of minimum version, if we were to move at all.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-p2v converts physical machines to virtual machines.  Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.
http://libguestfs.org/virt-v2v




More information about the Libguestfs mailing list