Base v0.11 released, with breaking changes

We just put out a new release of Base, version v0.11, and it is available in opam now. (Along with the rest of Jane Street’s open source libraries, which have all been released, with the same version number.)

Base hasn’t yet reached it’s 1.0 release, but we hope to get there in the next six months. One of our reasons for delaying the 1.0 release is that we intend for the 1.0 release to prioritize stability of the APIs, and there are a few changes that we need to make before then. You can see some of the remaining changes we want to make before declaring 1.0 on our Roadmap.

As of our 0.11 release, we’ve hit a majority of the issues on our roadmap, but there are still a few to go. But if stability is your top priority, you might want to wait for 1.0 before adopting Base.

You can find the Base changelog on GitHub, but here’s a version below, highlighting some of the breaking changes.

v0.11

Breaking Changes

  • Make ~compare a required argument to List.dedup_and_sort, List.dedup, List.find_a_dup, List.contains_dup, and List.find_all_dups.

  • Deprecated Not_found, people who need it can use Caml.Not_found, but its use isn’t recommended.

  • Removed unnecessary unit argument from Hashtbl.create.

  • Removed Hashable.t constructors from Hashtbl and Hash_set, instead favoring the first-class module constructors.

  • Removed Container operations from Either.First and Either.Second.

  • Changed the type of fold_until in the Container interfaces. Rather than returning a Finished_or_stopped_early.t (which has also been removed), the function now takes a finish function that will be applied the result if f never returned a Stop _.

  • Removed the String_dict module.

  • Removed List.exn_if_dup. It is still available in core_kernel.

  • Removed “normalized” index operation List.slice. It is still available in core_kernel.

  • Remove “normalized” index operations from Array, which incluced Array.normalize, Array.slice, Array.nget and Array.nset. These operations are still available in core_kernel.

  • Remove “normalized” index operations from String, which incluced String.normalize, String.slice, String.nget and String.nset. These operations are still available in core_kernel.

  • Removed approximate float comparison operations, e.g., (<=.)

Removal of deprecated functionality

  • Removed deprecated operations from Hashtbl.

Deprecations

  • Deprecated all_ignore in the Monad and Applicative interfaces in favor of all_unit.

  • Deprecated Array.replace_all in favor of Array.map_inplace, which is the standard name for that sort of operation within Base.

Documentation changes

  • Document that Array.find_exn, Array.find_map_exn, and Array.findi_exn may throw Caml.Not_found or Not_found_s.

  • Document that List.find_exn, and List.find_map_exn may throw Caml.Not_found or Not_found_s.

  • Document that List.find_exn may throw Caml.Not_found or Not_found_s.

  • Document that String.lsplit2_exn, and String.rsplit2_exn may throw Caml.Not_found or Not_found_s.

  • Document that List.find_exn, and List.find_map_exn may throw Caml.Not_found or Not_found_s.

Other enhancements

  • Added Sequence.group, similar to List.group.

  • Reimplemented String.Caseless.compare so that it does not allocate.

  • Added the Sexp.Not_found_s exception which will replace Caml.Not_found as the default exception in a future release.

  • Added Sys.argv.

  • Added a infix exponentation operator for int.

  • Added a Formatter module to reexport the Format.formatter type and updated the deprecation message for Format.

  • Added Sys.backend_type.

  • Added String.is_substring_at string ~pos ~substring. Used it as back-end for is_suffix and is_prefix.

  • Added Uniform_array module that is just like an Array except guarantees that the representation array is not tagged with Double_array_tag, the tag for float arrays.

  • Added Option_array module that allows for a compact representation of 'a option array, which avoids allocating heap objects representing Some a.

  • Moved all remaining Replace_polymorphic_compare submodules from Base types and consolidated them in one place within Import0.

  • Document that Hashtbl.find_exn may throw Caml.Not_found or Not_found_s.

  • Added a Poly submodule to Map and Set that exposes constructors that use polymorphic compare.

  • Added a Queue module that is backed by an Option_array for efficient and (non-allocating) implementations of most operations.

  • Added missing conversions between Int63 and other integer types, specifically, the versions that return options.

  • Added truncating versions of integer conversions, with a suffix of _trunc. These allow fast conversions via bit arithmetic without any conditional failure; excess bits beyond the width of the output type are simply dropped.

8 Likes

Thanks for starting the categorised changelog for Base releases, Yaron! It’s really useful to spot the breaking changes when we do builds in opam CI, as more packages are starting to use Base now.

1 Like

Removed the String_dict module.

Any chance that it will be reintroduced in Core? I was using it for something small, and while it’s not much of a hassle to replace, I suppose I’d rather use it if it’s available.

Looping in @seliopou and @trefis. I don’t know that we should add it back to Core, but maybe we can release it as a standalone library (which is what it is now internally.)

I’ll release it as a standalone package on Monday.

2 Likes