OCaml Batteries Included, alpha 3

February 6, 2009 § Leave a comment

Dear programmers.

I am happy to inform you that, despite the in-progress liquidation of French Universities, OCaml Batteries Included Alpha 3 has landed. Barring any accident, this should be the final Alpha version, with a mostly stable API and module structure. You may now download it from the Forge. A GODI package is also available and a Debian package should follow soon. You may also read the documentation on-line.

So, what’s new with Alpha 3? Plenty of things, as you’ll see.

General

  • OCaml Batteries Included is now available for both OCaml 3.10 and OCaml 3.11. Using OCaml 3.11 bring several additional features.

Language

  • A new syntax extension allows merging several modules into one:
    module List = List include Labels
    

    gives name List to a new module containing both List and Labels. This extension should simplify the use of labels, exception-less extensions, etc.

  • General and extendable data structure comprehension:
    [? i*i | i <- 1 -- 100 ; i mod 2 = 0&#93;
    &#91;/sourcecode&#93;
    
    produces an enumeration containing all the squares of even numbers between 1 and 100, while
    
    &#91;sourcecode language='php'&#93;
    &#91;? String : c | c <- open Char in 'a' -- 'z'&#93;
    &#91;/sourcecode&#93;
    
    produces string <code>"abcdefghijklmnopqrstuvwxyz"</code>. This works just as well with arrays, Unicode strings, Unicode ropes, doubly-linked lists, dynamic arrays, etc.</li>
    	<li>(OCaml 3.11 only) It is now possible to write Unicode strings, Unicode ropes, read-only strings, write-only strings, etc. Similarly, it is now possible to pattern-match against these strings with a natural syntax:
    
    # u"This is a Unicode string";;
    - : Batteries.UTF8.t = u"This is some Unicode string"
    # ro"This is a read-only string";;
    - : [`Read] Batteries.String.Cap.t = ro"This is some Unicode string"
    # r"This is a functional Unicode rope";;
    - : Batteries.Rope.t = r"This is a functional Unicode rope"
    

Library

  • After public consultation (1, 2), the module hierarchy has been completely rewritten into a mostly flat hierarchy, as per common OCaml usage.
  • New abstract thread-safe modules, to allow extensibility to e.g. coThreads.
  • Thread-safe version of the I/O library.
  • Old-style ArrayLabels, ListLabels, etc. have been replaced with Array.Labels, List.Labels, etc.
  • Plenty of new functions in Enum, Array, Hashtbl, Pervasives, String, Rope, Bingarray, Dllist, DynArray, Arg, Sys.
  • The File module now permits using temporary files.
  • New compatibility layer with OCamlNet.
  • New version of the Unix module, now compatible with I/O.
  • New module Future.Path for manipulating paths.
  • New module CharEncoding for transcoding inputs/outputs.
  • New module Date for manipulating time.

Documentation

  • The new documentation allows browsing modules by topics. If this is successful, this will be generalized to browsing values, types, etc. by topics.
  • New documentation generator.
  • New explanations on a number of subjects.
  • A number of docfixes.

Bugfixes

  • A host of bugfixes, in particular wrt Enum.

Toplevel

  • Loading speed improved.
  • More robust implementation of the toplevel.
  • Pretty-printers for UChar, Rope, String.Cap, UTF8.t.
  • More robust implementation of the help system.

Examples

  • Beginning of reimplementation of Pleac in idiomatic OCaml Batteries Included.
  • Opening a web-browser from a program.
  • Text encoding transcoder.
  • Solution of the Euler problem.

Build system

  • It is now possible to configure whether documentation should be generated.
  • Documentation installation made more robust.

What now?

Well, as any Alpha version, this code needs testing, lots of testing. So please consider using it and posting both feedback, requests for features and bug reports.

Besides testing and fixing bugs, our next few steps consist in

  • improving the documentation and the on-line help
  • attempting to decrease the size of binaries produced with Batteries
  • integrating Delimited Overloading
  • integrating more network features (OCamlNet)
  • a preference system
  • improving configurability of the GODI package.

And progressively moving towards 1.0!

The next release should be Beta 1 and is planned for March.

Have fun!

Leave a comment

What’s this?

You are currently reading OCaml Batteries Included, alpha 3 at Il y a du thé renversé au bord de la table.

meta