core 109.53.00-rc1

# 109.52.00

## async_core

- Changed `Pipe.iter_without_pushback` to never call `f` after
  `Pipe.close_read` has been called.

  The new behavior is like `Pipe.iter`.

  Changed the implementation of `Pipe.fold_gen` and `Pipe.transfer_gen`
  to be analogous to `Pipe.iter_without_pushback`, and in particular to
  process as many elements as possible before calling `values_available`.

## async_extra

- Added module `Cpu_usage`, which publishes CPU-usage statistics for
  the running process.
- Fixed `Sequencer_table.enqueue` so that there is no deferred between
  finding the state and calling the user function.

## async_unix

- Fixed a bug in `Unix.mkstemp`, which had a race because it used
  `Fd.create` in a thread.

  This bug affected `Writer.with_file_atomic`, `save`, `save_lines`,
  and `save_sexp`, and could cause corruption of the async scheduler
  data structures.
- Changed async to never do `set_nonblock` on `std{in,out,err}`, which
  allows `Core` I/O to use the standard file descriptors
  simultaneously with async.

  Before this change, the Core I/O libraries could (and sometimes did)
  fail due to `Sys_blocked_io`.
- Changed `Pipe.iter_without_pushback` to never call `f` after
  `Pipe.close_read` has been called.

  The new behavior is like `Pipe.iter`.

  Changed the implementation of `Pipe.fold_gen` and `Pipe.transfer_gen`
  to be analogous to `Pipe.iter_without_pushback`, and in particular to
  process as many elements as possible before calling `values_available`.
- Added `?expand_macros:bool` argument to `Reader.load_sexp*`
  functions, to support the new `Sexplib` macros.
- Added an optional argument to `Process.run` to accept nonzero exits
  as successful runs.

## core

- Added `Unix.File_descr.equal`.
- Added `Lock_file.Nfs.unlock`, the `Or_error` version of
  `unlock_exn`.
- Improved the detail of the error messages exposed by
  `Lock_file.Nfs.create{,_exn}`.
- Added `Unix.set_mcast_ifname`, to control the interface used for UDP
  multicast traffic.

  Added bindings for setsockopt `IP_MULTICAST_IF`.

  See 6.3 in: http://www.tldp.org/HOWTO/Multicast-HOWTO-6.html
- Changed `Command` argument processing to treat a single dash (`-`)
  as an anonymous argument rather than a flag.

  This change follows the unix convention of passing `-` as an
  anonymous argument meaning `stdin`.
- Added more bin-prot support to `Iobuf`: `Consume.bin_prot`,
  `Fill.bin_prot`, `Peek.bin_prot`, `Poke.bin_prot`.

  Framing doesn't do much for `Iobuf`, so these are to be more
  standard, unframed accessors, as opposed to `fill_bin_prot`.
- Added `Core.Debug.am`, `amf`, and `ams`, for outputting debugging
  messages showing the current source-code position.

  Unfortunately, these aren't available in `Core.Std.Debug`, but only
  in `Core.Debug`.  That will be fixed in 109.49.
- Made `Time_stamp_counter` compile on non x86-64 platforms.
- Made `Core.Std.Debug` be `Core.Debug` rather than
  `Core_kernel.Debug`.

  This exposes the `Debug.am*` functions added in 109.48.

## core_bench

- Exposed an extensible form of `make_command` so that
  inline-benchmarking and the other tools can add more commandline
  flags.
- A significant rewrite of `Core_bench`.

  The rewrite provides largely the same functionality as the older
  version.  The most visible external change is that the API makes it
  clear that `Core_bench` performs linear regressions to come up with
  its numbers.  Further, it allows running user-specified multivariate
  regressions in addition to the built in ones.

  The underlying code has been cleaned up in many ways, some of which
  are aimed at improving the implementation of inline benchmarking
  (the `BENCH` syntax, which has not yet been released).

## core_extended

- Removed `Sexp.load_sexp_with_includes`; one should use the new
  `Sexplib.Macro` functions.
- Added `Blang`-like languages `Flang` and `Olang`.
  * `Flang` -- terms over a field.
  * `Olang` -- predicates over an ordered set.

## core_kernel

- Added to `Binary_packing` module functions for packing and unpacking
  signed 64-bit ints in little- and big-endian.
- Changed the `Comparator` interfaces to no longer have `with bin_io`
  or `with sexp`.

  The `Comparator` interfaces are now just about having a comparator.

  Also, renamed `type comparator` as `type comparator_witness`.  And,
  removed `Comparator.S_binable`, since one can use:

  ```ocaml
  type t with bin_io
  include Comparator.S with type t :` t
  ```
- Changed `Comparator.Make` to return a module without a type `t`,
  like other `*able` functors,

   This made it possible to remove the signature constraint when
  `Comparator.Make` is applied.
- Made `Comparable.S_binable` be like `Comparable.S` and not have
  `type t with sexp`.

  The following two functors now fail to type check:

  ```ocaml
  module F1 (M : Comparable.S        ) : sig type t with sexp end ` M
  module F2 (M : Comparable.S_binable) : sig type t with sexp end ` M
  ```

  whereas previously `F1` was rejected and `F2` was accepted.
- Changed the `Monad.Make` functor to require a `val map` argument.

  This was done since we almost always want a specialized `map`, and
  we kept making the mistake of not overriding the generic one in the
  three places needed.

  Added `Monad.map_via_bind`, which one can use to create a standard
  `map` function using `bind` and `return`.
- Removed unnecessary signature constraints on the result of applying
  `Monad.Make`.

  Some time ago, `Monad.Make` changed from returning:

  ```ocaml
  S with type 'a t ` 'a M.t
  ```

  to returning:

  ```ocaml
  S with type 'a t :` 'a M.t
  ```

  so we no longer need to constrain the result of `Monad.Make` at its
  uses to remove `t`.
- Changed `String.exists` and `String.for_all` to iterate by
  increasing index rather than decreasing.
- Added `with compare` to module `Ref`.
- Made `Flags` be `Comparable`, with the order consistent with bitwise
  subset.
- Cleaned up the implementation of `Union_find`.

  Improvemed the code in `union_find.ml`:

  * Removed an assert false.
  * do not reallocate a parent node during compress. This should
    result in more stability for sets memory wise.
  * Added implementation notes.
  * Renamed internal variant constructors.
  * Added unit tests.
- Added `Float.O`, a sub-module intended to be used with local opens.

  The idea is to be able to write expressions like:

  ```ocaml
  Float.O.((3. + 4.) > 6. / 2.)
  ```

  This idiom is expected to be extended to other modules as well.
- Added a `sexp_of_t` converter to `Type_equal.Id`.
- Replaced `Univ.Constr` with `Type_equal.Id`.
- Added `Debug.eprintf`, analogous to `eprint` and `eprints`.

## pa_ounit

- Added `-stop-on-error` flag to `inline_test_runner`, to stop running
  tests at the first failure.

  This is useful if the remaining tests are likely to fail too or just
  long to run.

## pa_test

- Added an optional `?message` argument to `<:test_eq<>>`,
  `<:test_result<>>` and `<:test_pred<>>`.

## re2

- Fixed bugs in `Re2.Regexp.find_all` and `Re2.Regexp.find_first`.
  * memory leaks on errors
  * unlikely garbage in their return values, or even segfaults
    (especially unlikely for `find_first`)

## sexplib

- Added a `Macro` module, with `load_sexp*` functions that support
  file includes and templates.

  The following new syntaxes are supported:

  ```scheme
  (:include filename)
  (:let f (arg1 ... argn) sexp1 ... sexpn)
  (:use f (arg1 valn) ... (argn valn))
  (:concat a1 ... an)
  ```
- Added support to `with sexp` for a subset of GADTs.

  The new support is for types that use existentially quantified
  variables or plain variants written with GADT syntax.

  Existentially quantified variables still have to be wrapped with
  `sexp_opaque` generate compiling code.
- Fixed a type error in the code generated by `with sexp` in some
  cases of variant inclusions.

## textutils

- Added `Console.Log` module for writing colorized `Async.Log`
  messages.

## type_conv

- Removed comments from pretty-printed types in `type_conv` error
  messages.

# 109.53.00

## async

Bump version number

## async_extra

- Added module `Bus`, which is an intraprocess "broadcast"
  communication mechanism.
- Added `Tcp.to_inet_address` and `to_unix_address`.
- Added `Tcp.to_socket` which creates a `Tcp.where_to_connect` from a
  `Socket.Address.Inet.t`.
- Module `Weak_hashtbl` is now implemented as a wrapper around
  `Core.Weak_hashtbl`.

  No intended change in behavior.

## async_unix

- Changed the scheduler to calibrate `Time_stamp_counter` every
  second.
- Improved error messages in the scheduler when `epoll` functions
  raise.
- Made `Scheduler.reset_in_forked_process` close the `epoll` file
  descriptor.

## bin_prot

Bump version number

## core

- Added `Linux_ext.Epoll.close`.
- Added `Weak_hashtbl` module, moved from `Async`.

  It had only been in `Async` to use `Async`'s finalizers.  The move
  to `Core` exposes a bit more with respect to finalization so that
  one can still implement `Async.Weak_hashtbl`, as well as do other
  things (e.g. use `Weak_hashtbl` in `Incremental`, which does not use
  `Async`).

  Simplified the implementation of `Weak_hashtbl` to eliminate "entry
  ids".  They were only used to avoid removing a table entry that was
  in use.  But there is a more direct way to test for that -- just
  check if the weak is `None` or `Some`.
- Added an autoload file for utop
- Disabled warning 40 in corebuild

## core_bench

- Fixed a bug in `Core_bench` where the linear regression was
  sometimes supplied with spurious data.

  This showed up when doing custom regressions that allow for a non-zero
  y-intercept.

## core_extended

- Fixed `Flang` and `Olang` to round-trip via sexps, i.e. `(t_of_sexp
  (sexp_of_t t)) = t`.

## core_kernel

- Added `Float.to_string_round_trippable`, which produces a string
  that loses no precision but (usually) uses as few digits as
  possible.

  This can eliminate noise at the end (e.g. `3.14` not
  `3.1400000000000001243`).

  Benchmarks:

  New sexp:

  ```
  ┌────────────────────────┬──────────┬─────────┬────────────┐
  │ Name                   │ Time/Run │ mWd/Run │ Percentage │
  ├────────────────────────┼──────────┼─────────┼────────────┤
  │ new Float.sexp_of 3.14 │ 463.28ns │   6.00w │     48.88% │
  │ new Float.sexp_of e    │ 947.71ns │  12.00w │    100.00% │
  └────────────────────────┴──────────┴─────────┴────────────┘
  ```

  Old sexp:

  ```
  ┌────────────────────────┬──────────┬─────────┬────────────┐
  │ Name                   │ Time/Run │ mWd/Run │ Percentage │
  ├────────────────────────┼──────────┼─────────┼────────────┤
  │ old Float.sexp_of 3.14 │ 841.99ns │ 178.00w │     98.03% │
  │ old Float.sexp_of e    │ 858.94ns │ 178.00w │    100.00% │
  └────────────────────────┴──────────┴─────────┴────────────┘
  ```

  Much of the speedup in the 3.14 case comes from the fact that
  `format_float "%.15g"` is much faster than `sprintf "%.15g"`.  And
  of course the above does not capture any of the benefits of dealing
  with shorter strings down the road.

  Here are some detailed benchmarks of the various bits and pieces of
  what's going on here:

  ```
  ┌─────────────────────────────────────┬────────────┬─────────┬────────────┐
  │ Name                                │   Time/Run │ mWd/Run │ Percentage │
  ├─────────────────────────────────────┼────────────┼─────────┼────────────┤
  │ format_float '%.15g' 3.14           │   335.96ns │   2.00w │     32.71% │
  │ format_float '%.17g' 3.14           │   394.18ns │   4.00w │     38.38% │
  │ format_float '%.20g' 3.14           │   459.79ns │   4.00w │     44.77% │
  │ format_float '%.40g' 3.14           │   638.06ns │   7.00w │     62.13% │
  │ sprintf '%.15g' 3.14                │   723.71ns │ 165.00w │     70.47% │
  │ sprintf '%.17g' 3.14                │   803.44ns │ 173.00w │     78.23% │
  │ sprintf '%.20g' 3.14                │   920.78ns │ 176.00w │     89.66% │
  │ sprintf '%.40g' 3.14                │   990.09ns │ 187.00w │     96.41% │
  │ format_float '%.15g' e              │   357.59ns │   4.00w │     34.82% │
  │ format_float '%.17g' e              │   372.16ns │   4.00w │     36.24% │
  │ format_float '%.20g' e              │   434.59ns │   4.00w │     42.32% │
  │ format_float '%.40g' e              │   592.78ns │   7.00w │     57.72% │
  │ sprintf '%.15g' e                   │   742.12ns │ 173.00w │     72.26% │
  │ sprintf '%.17g' e                   │   747.92ns │ 173.00w │     72.83% │
  │ sprintf '%.20g' e                   │   836.30ns │ 176.00w │     81.43% │
  │ sprintf '%.40g' e                   │ 1_026.96ns │ 187.00w │    100.00% │
  │ valid_float_lexem 12345678901234567 │    76.29ns │   9.00w │      7.43% │
  │ valid_float_lexem 3.14              │     9.28ns │   5.00w │      0.90% │
  │ float_of_string 3.14                │   130.19ns │   2.00w │     12.68% │
  │ float_of_string 1234567890123456.7  │   184.33ns │   2.00w │     17.95% │
  │ to_string 3.14                      │   316.47ns │   7.00w │     30.82% │
  │ to_string_round_trippable 3.14      │   466.02ns │   9.00w │     45.38% │
  │ to_string e                         │   315.41ns │   7.00w │     30.71% │
  │ to_string_round_trippable e         │   949.12ns │  15.00w │     92.42% │
  └─────────────────────────────────────┴────────────┴─────────┴────────────┘
  ```

- Replaced `Float.min_positive_value` with `min_positive_normal_value`
  and `min_positive_subnormal_value`.
- Added some functions to `Float.O`: `abs`, `of_float`, and
  `Robustly_comparable.S`.
- Small improvements to the `Heap` module.

  Implemented `Heap.iter` directly rather than in terms of `fold`.

  In `heap.ml`, fixed the idiom for using `Container.Make`.
- Added an `Int.O` and other `Int*.O` modules, with arithmetic
  operators, infix comparators, and a few useful arithmetic values.
- Added `Int.( ~- )`, for unary negation.
- Added `Pool.unsafe_free`.
- Added `Percent` module.

## ocaml_plugin

Bump version number

## pa_ounit

Bump version number

## pa_test

Bump version number

## patdiff

Bump version number

## re2

Bump version number

## sexplib

- Changed `sexp_of_float` to (usually) use as few digits as possible,
  without losing precision.
- Split the part of `Sexplib` that depends on `Num` into a separate
  library, `Sexplib_num`.

  This was done to eliminate the dependence of `Core_kernel` on `Num`,
  which is not usable on javascript.

## textutils

Bump version number

## type_conv

Bump version number