[ANN] containers 3.0

Dear y’all and all y’all’s,

I’m happy to announce, on behalf of containers’ contributors, the release of containers 3.0. API documentation can be found here.

Containers is a BSD-licensed standard library extension [1] that aims at being lightweight, convenient, modular, portable, and only pay for what you use; that includes compatibility with OCaml >= 4.03. This is the second major update in 7 years of existence, following semantic versioning.

Release 3.0 was the opportunity to clean up some inconsistencies (in printers, among others), to focus on the standard Seq.t type, and to split some sub-libraries into their own packages (containers-thread and containers-data respectively). The hope is that the new version is more consistent, lightweight, and pleasant to use.

I want to thank all contributors for their hard work, and in particular Fardale.

[1]: as in, containers extends the stdlib and does not intend to replace it.

Overview of breaking changes

(this is extracted from the readme’s migration section)

  1. The biggest change is that some sub-libraries have been either turned into
    their own packages (containers-thread, containers-data),
    deleted (containers.iter),or merged elsewhere (containers.sexp).
    This means that if use these libraries you will have to edit your
    dune/_oasis/opam files.
  • if you use containers.sexp (i.e. the CCSexp module), it now lives in
    containers itself.
  • if you used anything in containers.data, you need to depend on the
    containers-data package now.
  1. Another large change is the removal (at last!) of functions deprecated
    in 2.8, related to the spread of Seq.t as the standard iterator type.
    Functions like CCVector.of_seq now operate on this standard Seq.t type,
    and old-time iteration based on iter
    is now named of_iter, to_iter, etc.

Here you need to change you code, possibly using search and replace.
Thankfully, the typechecker should guide you.

  1. Array_slice and String.Sub have been removed to simplify the
    code and String more lightweight. There is no replacement at the moment.
    Please tell us if you need this to be turned into a sub-library.

  2. Renaming of some functions into more explicit/clear names.
    Examples:

  • CCVector.shrink is now CCVector.truncate
  • CCVector.remove is now CCVector.remove_unordered, to be
    contrasted with the new CCVector.remove_and_shift.
  • CCPair.map_fst and map_snd now transform a tuple into another tuple
    by modify the first (resp. second) element.
  1. All the collection pretty-printers now take their separator/start/stop
    optional arguments as unit printer (i.e. Format.formatter -> unit -> unit
    functions) rather than strings. This gives the caller better control
    over the formatting of lists, arrays, queues, tables, etc.

  2. Removal of many deprecated functions.

11 Likes

Awesome! Thank you, I’m a big user of containers and appreciate the hard work by everyone.

3 Likes