Dear OCaml developers,
We are pleased to announce the v0.13 release of Jane Street packages!
This release comes with 14 new packages, and a number of fixes and
enhancements. The documentation for this release is available on our
website:
https://ocaml.janestreet.com/ocaml-core/v0.13/doc/
The remainder of this mail highlights the main changes since the v0.12
release; we hope it will be useful to developers in the process of
migrating to the new version. A comprehensive changelog is available
at the end.
Notable changes
-
Changed
Base
,Core_kernel
, andCore
functions to raise
Not_found_s
instead ofNot_found
.Hashtbl.find_exn
and
Map.find_exn
now include the key in their error message. -
Changed
Core
andCore_kernel
to exportint
comparison rather
than polymorphic comparison. -
Removed the ārobustā float comparison operators (
>.
,=.
, ā¦)
from the default namespace. -
Replaced
sexp_*
types (sexp_list
,sexp_option
,sexp_opaque
,
ā¦) with preprocessor attributes ([@sexp.list]
,[@sexp.option]
,
[@sexp.opaque]
, ā¦). -
Changed
let%map
syntax fromlet%map.Foo.Let_syntax
to
let%map.Foo
. -
Added to
match%optional
support for specifying a path, so you can
writematch%optional.Foo foo_option
rather thanlet open Foo.Optional_syntax in match%optional foo_option
. -
Improved
Base.Backtrace
so that it enables recording of backtraces
in more situations, specifically whenOCAMLRUNPARAM
is defined but
doesnāt mention the backtrace flag,b
. -
Added javascript support for
Zarith
,Bigint
,Bignum
, and
Bigdecimal
. -
Changed
Hashtbl.create
's defaultsize
from 128 to 0. -
Changed
Core_kernel.Command
so that all commands accept double
dash flags:--help
,--version
, and--build-info
.
New packages
-
async_udp (https://github.com/janestreet/async_udp): UDP support for
Async. -
async_websocket (https://github.com/janestreet/async_websocket):
A library that implements the websocket protocol on top of Async. -
bonsai (https://github.com/janestreet/bonsai): A library for building
dynamic webapps, using Js_of_ocaml. -
postgres_async (https://github.com/janestreet/postgres_async):
OCaml/async implementation of the postgres protocol (i.e., does not
use C-bindings to libpq). -
ppx_cold (https://github.com/janestreet/ppx_cold): Expands
[@cold]
into[@inline never][@specialise never][@local never]
. -
ppx_pattern_bind (https://github.com/janestreet/ppx_pattern_bind):
A ppx for writing fast incremental bind nodes in a pattern match. -
ppx_python (https://github.com/janestreet/ppx_python):
[@@deriving]
plugin to generate Python conversion functions. -
ppx_yojson_conv (https://github.com/janestreet/ppx_yojson_conv):
[@@deriving]
plugin to generate Yojson conversion functions. -
ppx_yojson_conv_lib (https://github.com/janestreet/ppx_yojson_conv_lib):
Runtime lib forppx_yojson_conv
. -
pythonlib (https://github.com/janestreet/pythonlib): A library to
help writing wrappers around OCaml code for python. -
sexp_select (https://github.com/janestreet/sexp_select): A library
to use CSS-style selectors to traverse sexp trees. -
timezone (https://github.com/janestreet/timezone): Time-zone handling.
-
toplevel_backend (https://github.com/janestreet/toplevel_backend):
Shared backend for setting up toplevels. -
zarith_stubs_js (https://github.com/janestreet/zarith_stubs_js):
Javascript stubs for the Zarith library.
Deprecations / Removals
Async_kernel
:
- Deprecated monadic
ignore
functions in favor ofignore_m
.
Base
:
-
Deleted
Array.replace
andreplace_all
functions, which have been
deprecated since before the last public release. -
Deprecated
Result.ok_unit
; useOk ()
. -
Removed the
Monad
andApplicative
interfacesāall_ignore
function; it was previously deprecated and replaced byall_unit
. -
Removed
List.dedup
, which has been deprecated since 2017-04. -
Removed
String
mutation functions, which have been deprecated in
favor ofBytes
since 2017-10. -
Deprecated
Array.truncate
,Obj_array.unsafe_truncate
, and
Uniform_array.unsafe_truncate
. -
Deprecated
Sys.argv
, which has been superseded byget_argv
,
which is a function, reflecting the fact thatargv
can change (as
of OCaml 4.09).
Core_kernel
:
-
Removed
Core_kernel.Std
, which had been deprecated for a year. -
Deprecated type
Command.Spec.param
in favor ofCommand.Param.t
. -
Removed
Hashtbl
functions that had been deprecated for years. -
Removed
Float.to_string_round_trippable
, which has been deprecated
in favor ofto_string
since 2017-04. -
Deprecated
Fqueue
functions where one should useFdeque
instead:
bot
,bot_exn
, andenqueue_top
. -
Deleted
Bus.unsubscribes
, which will be obviated by a performance
improvement toBus.unsubscribe
.
Timing_wheel
:
- Removed the
alarm_upper_bound
function, which has been deprecated
for 6 months, and superseded bymax_allowed_alarm_time
.
Moves
Core_kernel
:
-
Moved
Bounded_int_table
to a standalone library. -
Moved the
Pool
andTuple_type
modules to a standalone library,
Tuple_pool
.
Async_unix
:
- Moved
Unix.Fd.replace
into aPrivate
submodule.
Changelog
Async
:
- Added module
Expect_test_config_with_unit_expect
, an alternative
toExpect_test_config
in which[%expect]
has typeunit
rather
thanunit Deferred.t
.
Async_kernel
:
-
Exposed type
Async_kernel_config.t
. -
Added a public-facing interface to the
Async_kernel_scheduler
module, taking the subset ofAsync_unix.Scheduler
that makes sense
inAsync_kernel
. -
Added to
Time_source
andSynchronous_time_source
andId
submodule, so that you can put them in a hash table or map. -
Added
Deferred.Or_error.tag_s
function. -
Added to
Require_explicit_timesource
deprecations ofDate.Today
andTime.now
. -
Added
Synchronous_time_source.length
function. -
Added
Synchronous_time_source
functionsreschedule_at
and
reschedule_after
. -
Optimized
Bvar
so that its internal identity coercions can be
inlined. -
Added
Time_source.advance_by_alarms_by
function, like
advance_by_alarms
but takesTime_ns.Span.t
. -
Deprecated monadic
ignore
functions in favor ofignore_m
. -
Renamed
Time_source.advance
functions asadvance_directly
. -
Added to
Synchronous_time_source
anadvance_directly
function. -
Added
Throttle.enqueue_exclusive
function, which enqueues a job
that occupies all slots of the throttle. -
Optimized
Pipe.of_list
so that it creates one queue rather than
two. -
Added to
Pipe.t
a field,info : Sexp.t
, intended to make debug
messages more useful. -
Added
Pipe.empty
function, equivalent toPipe.of_list []
.
Async_rpc_kernel
:
-
Improved the error message when a message cannot be sent because it
is too big, cutting out a lot of noise. -
Added an expert function that constructs an
Rpc.Implementation.t
directly given just therpc_tag
andversion
. -
Added
Async_rpc_kernel_stable
module. -
Added type
Implementations.on_unknown_rpc
. -
Added
State_rpc.client_pushes_back
function, like the same
function inPipe_rpc
.
Async_unix
:
-
Changed
In_thread.run
to not initialize the scheduler. -
Optimized
Unix.mkdir ~p:()
to useCore.Unix.mkdir_p
rather than
its own loop, avoiding many calls toIn_thread.syscall_exn
. -
Added to
Log.Output
creation functions an optional argument:
?perm:Unix.file_perm
. -
Added function
Shutdown.is_shutting_down : unit -> bool
. -
Added to
Process.run*
functions an optional argument:?argv0 : string
, likeProcess.create
. -
Added to
Unix
typessocket_domain
andsocket_type
:
[@@deriving compare, hash]
. -
Changed the Async scheduler to clear its epoll setās ready file
descriptors after it processes them, so that the already-processed
file descriptors do not misleadingly appear in the schedulerās sexp. -
Added to
Require_explicit_timesource
deprecations of
Time.Ofday.now
andTime_ns.Ofday.now
. -
Made
In_thread.run
's default?when_finished
configurable via a
ref, so that an application can change the default globally. -
Moved
Unix.Fd.replace
into aPrivate
submodule. -
Improved
Socket.sexp_of_t
. -
In
Tcp
's socket-creation function, removed a call to
Unix.set_close_on_exec
, which is unnecessary because
Socket.create
already does it. -
Fixed a bug in
Reader.transfer
where if the reader has no data to
read and the outputPipe.Writer.t
is closed, the returned deferred
would not be determined. -
Added support to
Writer
for using a customTime_source.t
instead
of the wall clock. -
Reworked
Writer
's buffer-age check. -
Fixed a stack overflow in
Writer
sexp conversion. -
Added to
Process.run
and related functions a?prog_search_path
argument. -
Treat
.mlt
files as tests, in particular so thatWriter
uses
synchronous output.
Base
:
-
Added
Or_error.tag_s
function. -
Updated
Base
for OCaml 4.08. -
Changed
Base
functions to raiseNot_found_s
instead of
Not_found
.Hashtbl.find_exn
andMap.find_exn
now
include the key in their error message. -
Optimized
Map.update
. -
Deleted
Array.replace
andreplace_all
functions, which have been
deprecated since before the last public release. -
Deprecated
Result.ok_unit
; useOk ()
. -
Added
Map.fold_symmetric_diff
function, which is more efficient
thansymmetric_diff
, due to avoidingSequence
. -
Removed the
Monad
andApplicative
interfacesāall_ignore
function; it was previously deprecated and replaced byall_unit
. -
Removed
List.dedup
, which has been deprecated since 2017-04. -
Added function
Map.iteri_until
. -
Removed
String
mutation functions, which have been deprecated in
favor ofBytes
since 2017-10. -
Updated
Int63.t
to use[@@immediate64]
attribute. -
Changed
Hashtbl.create
's defaultsize
from 128 to 0. -
Added
List
functionsdrop_last
anddrop_last_exn
. -
Added
Sequence.equal
function. -
Made
Base
build with OCaml 4.06. -
Improved support for
Applicative.S2
, adding signatures
(Applicative_infix2
,Let_syntax2
) and functors
(Make_let_syntax2
,Of_monad2
). -
Added
Hash_set.union
function. -
Added
Hashtbl
functionschoose
andchoose_exn
, analogous to
Set
functions of the same name. -
Added
Map.M
andSet.M
support for[@@deriving equal]
. -
Added functions
Map.binary_search
andSet.binary_search
. -
Deprecated
Array.truncate
,Obj_array.unsafe_truncate
, and
Uniform_array.unsafe_truncate
. -
Made
Field.t_with_perm
be[@@unboxed]
. -
Added
Sys.getenv
andgetenv_exn
. -
Added
Comparable.reverse
function, which reverses the ordering of
a comparison function. -
Changed
Random.State.default
to be lazily initialized,
nondeterministically, when not in test. -
Deprecated
Sys.argv
, which has been superseded byget_argv
,
which is a function, reflecting the fact thatargv
can change (as
of OCaml 4.09). -
Added
Random
functionschar
andascii
. -
Added to
Comparable.S
functions:equal
,min
,max
. -
Added to
Map
functions for creating maps from sequences. -
Fixed
Float.box
so that it works with flambda. -
Fixed
Map.t_of_sexp
andHashtbl.t_of_sexp
so that on failure
they raiseOf_sexp_error
, so that sexp loading functions report
error locations. -
Added
Applicative.S3
interface. -
Improved
Backtrace
so that it enables recording of backtraces in
more situations, specifically whenOCAMLRUNPARAM
is defined but
doesnāt mention the backtrace flag,b
. -
In
Type_equal.Id.to_sexp
, eliminated an unnecessary allocation
when it is partially applied. -
Added
Option_array
functionunsafe_get_some_assuming_some
, which
is similar tounsafe_get_some_exn
, except that it is faster and
more unsafe because it avoids testing that its argument isSome
. -
Added to
Sequence
functions converting to and fromCaml.Seq.t
. -
Removed from
Sequence
a vestigial performance hack intended to
improve partial application. -
Made
List
matchInvariant.S1
. -
Changed
Hashtbl.equal
's argument order to match the standard
order, taking the data equality function first. -
Made many modules match
Invariant.S
:Bool
,Char
,Int
, ā¦
Base_bigstring
:
-
Renamed safe, checking binary setters (e.g.
set_int8
), adding an
_exn
suffix to indicate that they may raise. -
Fixed a bug in range-checking
~pos
and~len
, which could
overflow when they are large. -
Added
Bigstring.copy
function. -
Marked
Bigstring.unsafe_blit
as[@@noalloc]
.
Bignum
:
-
Made
Bignum
matchEqual.S
. -
Added javascript support for
Zarith
,Bigint
,Bignum
,
Bigdecimal
, andBig_dollars
. -
Added
Bigint.Stable.V2
serialization format, which is always
strictly smaller than the V1 format, and is always the same
regardless of the architecture. -
Adding a new serialization format,
V3
, which makes native and
javascript serialize things the same way.
Core
:
-
Added
Unix.Cidr.arg_type
. -
Changed
Core
to exportint
comparison rather than polymorphic
comparison. -
Optimized
Unix.mkdir_p
to to create the directories starting from
the deepest one instead of from the root. -
Exposed type equality between
Time_ns.comparator
and
Time_ns.Stable.V1.comparator
. -
Changed
Unix.getnameinfo
to raiseNot_found_s
. -
Fixed a bug in
Unix.mkdir_p
, which mistakenly did not use its
perm
argument on the first directory it creates. -
Added function
Linux_ext.Epoll.Expert.clear_ready
. -
Replaced
Unix.File_descr
's[@@deriving bin_io, sexp]
with
[@@deriving sexp_of]
; similarly forLinux_ext.Timer_fd
and
Unix.Process_info
. -
Changed
Unix.File_descr.sexp_of_t
to elide the file descriptorās
value whenam_running_test
. -
Added
Unix.Stable.Signal
submodule. -
Added
Sys.override_argv
function. -
In
bigstring_stubs.c
, switched some uses offree
to
caml_stat_free
. -
Added
Iobuf
functionslength_lo
andlength_hi
. -
Added
Iobuf.memcmp
function. -
Added
Iobuf.blit_maximal
function. -
Added to
Unix.Cidr
a function,broadcast_address
, that returns
the subnetās broadcast address. -
Add
Iobuf
expert-only setter functions for each field:
Expert.set_{buf,lo_min,lo,hi,lo_max}
. -
Added
Time
andTime_ns
functions for converting to and from
Ofday.Zoned.t
. -
Added
Iobuf.fillf_float
function, for formatting a float in an
iobof as specified by a C-style printf format string. -
Changed the type of
Thread.create
so that the function to be run
in the new thread must return unit. -
Added to
Thread.create
a required argumenton_uncaught_exn:[ `Kill_whole_process | `Print_to_stderr ]
. -
Moved
Core
's time-zone parsing code into its own library,
Timezone
, that depends onCore_kernel
.
Core_bench
:
- Made
Core_bench
stdless.
Core_kernel
:
-
Added
Core_kernel.eprint_s
, likeprint_s
but to stderr. -
Removed
Core_kernel.Std
, which had been deprecated for a year. -
Changed
Command
so that when command-line parsing fails, it prints
a more descriptive message explaining how to get usage information. -
Fixed
Command
so that for invalid command lines, it prints the
entire error message on stderr, rather than printing some of it on
stdout. -
Made
Filename
matchComparable.S
. -
Deprecated type
Command.Spec.param
in favor ofCommand.Param.t
. -
Changed
Core_kernel
to exportint
comparison rather than
polymorphic comparison. -
Removed
Hashtbl
functions that had been deprecated for years. -
Added support for
type t = Map.M(Int).t [@@deriving bin_io]
and
type t = Set.M(Int).t [@@deriving bin_io]
. -
Changed
Bigbuffer.add_substitute
to raiseNot_found_s
. -
Moved
Bounded_int_table
to a standalone library. -
Changed
Command
's autocompletion shell functions to disable word
splitting using an empty string rather than a null byte, which works
better forzsh
. -
Exposed
Date.t
as[@@immediate]
. -
Added to
Hash_queue
accessor functions that are polymorphic in the
key type, making its interface more likeHashtbl
andMap
. -
Switched
Hash_queue
's implementation from custom exceptions to
raise_s
. -
Added
Percent
rounding functions:round_significant
,
round_decimal_{mult,percentage,bp}
. -
Added to
Time{,_ns}.Ofday.Zoned.With_nonchronological_compare
:
[@@deriving equal]
. -
Added
Time_ns
functions:is_earlier
,is_later
. -
Added
Bag.S
interface. -
Added
Doubly_linked.S]
interface. -
Added
Gc.Control.t
definition for the new OCaml 4.08 fields. -
Added
Quickcheck
bindings toTime
andTime_ns
. -
In
bigstring_stubs.c
, replaced uses ofcaml_ba_unmap_file
with
calls to the bigstringāsfinalize
function, in preparation for
OCaml 4.08. -
Added
Or_error.Expect_test_config
module. -
Removed
Float.to_string_round_trippable
, which has been deprecated
in favor ofto_string
since 2017-04. -
Deprecated
Fqueue
functions where one should useFdeque
instead:
bot
,bot_exn
, andenqueue_top
. -
Changed the definition of
Nothing.t
from an uninhabited
Type_equal.t
to an empty variant. -
Moved the
Pool
andTuple_type
modules to a standalone library,
Tuple_pool
. -
Added
Fdeque
andFqueue
functions to convert to and from
Sequence
. -
Dropped
Hash_set.create
's unnecessary unit argument. -
Changed
Time_ns
functionsof_int_ns_since_epoch
and
Span.of_int_ns
on on 32-bit platforms so that they work rather
than always raising. -
Changed
Command.Param.choose_one
's~if_nothing_chosen
argument
from a polymorphic variant to a GADT, and added a constructor that
makes it return an option. -
Added
Byte_units.zero
. -
Changed
Byte_units
to use uppercase letters for the unit suffixes. -
Made
Day_of_week
derivequickcheck
. -
Added
Map
functionskey_set
andof_key_set
, for converting
between aMap.t
and theSet.t
of its keys. -
Added
Bus.unsubscribes
function, for efficient batched
unsubscription from a bus. -
Made
Percent
matchQuickcheckable.S
. -
Made
String_id.S
matchQuickcheckable.S
. -
Improved the
Quickcheck
monad to allow nestedlet%map
syntax. -
Exported the
Intable
module. -
Added
Command.Param.and_arg_names
, to extract arg names from a
Command.Param.t
. -
Fixed a bug in
Gc.keep_alive
that caused it to sometimes not work
with flambda. -
Fixed a bug in deserialization of time zones without offsets (
GMT
,
UTC
). -
Changed
Command.basic
to callString.strip
on its?readme
argument. -
Exposed
Float.Robustly_comparable
submodule. -
Optimized
Union_find
not allocate in operations where one already
has a root. This also affectsBag
andDoubly_linked
. -
Removed the ārobustā float comparison operators (
>.
,=.
, ā¦)
from the default namespace. -
Improved
Command
's generated help to clarify thatlisted
and
one_or_more
flags can be repeated. -
Deleted
Bus.unsubscribes
, which will be obviated by a performance
improvement toBus.unsubscribe
. -
Added
Time_ns.Ofday.Option.of_span_since_start_of_day
, which will
returnnone
on an invalid span. -
Added
Blang
support forQuickcheckable.S1
. -
In
Bus
, optimizedsubscribe_exn
andunsubscribe
, changing them
from linear time (in the number of subscribers) to amortized
constant time. -
In
Bus
, relaxed functions that take a'callback Read_only.t
to
instead take a('callback, [> read ]) t
, which lets us eliminate a
bunch of pointless calls toBus.read_only
in client code. -
Added
Time_ns
functionsadd_saturating
andsub_saturating
,
which clamp rather than overflow. -
Added
Option.Optional_syntax
submodule, so that you can use
ordinary options with immediate options inmatch%optional
. -
Included
Byte_units.Infix
operators in the mainByte_units
module. -
Changed
Command
so that all commands accept double dash flags:
--help
,--version
, and--build-info
. -
Added
Tuple2.map
andTuple3.map
functions.
Delimited
:
- Changed
Read
with~strip:true
to useChar.is_whitespace
,
rather than strip only space characters.
Expect_test_helpers
:
-
Generalized the
Expect_test_helpers.run
functionās?print_stdout
and?print_stderr
arguments from typebool
to typePrint_rule.t = Always | If_unclean_exit | Never
. -
Removed the
require_no_allocation
functionās?cr:CR.t
argument,
which was an attractive nuisance.
Incremental
:
-
Changed
Clock.advance_clock
so that it calls
Timing_wheel.fire_past_alarms
, so people donāt have to reason
about [alarm_precision] when thinking about whether alarms have
fired. -
Changed
Clock.advance_clock
so that advancing time backwards is a
no-op, rather than doing something wrong. -
Improved
Observer.sexp_of_t
to show just the observerās value or
an informative message, omitting a bunch of internal state. -
Changed
Incremental.Clock
's default timing-wheel configuration so
that it handle alarms for all times up to
Time_ns.max_value_representable
. -
Removed the
advance_clock
functionās~deprecated_allow_backwards
argument. -
Added
map11
, ā¦,map15
functions. -
Added
[@@unboxed]
in a couple places to improve performance. -
Generalized the
unordered_array_fold
functionāsf_inverse
argument to also allow anupdate
function, which can more
efficiently implement the composition off_inverse
andf
. -
Generalized
step_function
to allow the steps to be specified via a
sequence and to allow the step function to be an incremental value. -
Made it possible to write functions that deal with incrementals
without committing to a particular instance of the module created by
Incremental.Make
. -
Added generic
sexp_of_t
functions. -
Added to
type state_witness
[@@deriving sexp_of]
. -
Exposed more equalities between types in
Incremental
and
Incremental.S
. -
Added
Incremental.state
accessor function. -
Added
Incremental.State.create
, a generic function for creating an
incremental state, along with itsstate_witness
type.
Ppx_comapre
:
- Fixed a bug in
[@compare.ignore]
, which generated unannotated
ignores that were then rejected byppx_js_style
.
Sexp_pretty
:
- Fixed handing of block comments (
#| |#
).
Stdio
:
- Added
Out_channel.eprint_s
function.
Timing_wheel
:
-
Changed
Config.create
to trimlevel_bits
as needed according to
alarm_precision
. -
Fixed
Config.durations
to not overflow. -
Added to
Level_bits.create_exn
an optional argument,
?extend_to_max_num_bits:bool
, which is useful for extending a
timing wheelās level bits so that the full range of times is
covered. -
Removed the
alarm_upper_bound
function, which has been deprecated
for 6 months, and superseded bymax_allowed_alarm_time
. -
Changed
Timing_wheel
's max supported time from:
Time_ns.max_value_for_1us_rounding
to
Time_ns.max_value_representable
. -
Extended
Timing_wheel
's supported key bits from 61 to 62, so that
it supports allTime_ns.t
values withalarm_precision = 1ns
. -
Made all
Timing_wheel
tests run on 32-bit platforms.
Uopt
:
- Added support for
match%optional
syntax.