Dear OCaml developers,
We are pleased to announce the v0.14 release of Jane Street packages!
This release comes with 15 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.14/doc/
The remainder of this mail highlights the main changes since the v0.13
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
-
Updated
Bin_prot
functorsBinable.Of_sexpable
and
Binable.Of_stringable
to take UUIDs. -
Changed
Base
andCore
partition*
functions from using[ `Fst of 'a | `Snd of 'b ]
to using('a, 'b) Either.t
. -
Replaced
Date
functionsadd_weekdays
andadd_business_days
with functions that clarify the behavior w.r.t. weekends. -
Added syntax
while%bind
, analogous toif%bind
. -
Added to the
Async.Log.create
function a required unit argument,
and an optional argument to specify aSynchronous_time_source.t
. -
Made
Core_kernel
deprecate theUnix
module, recommending
Core.Unix
, withCaml_unix
as a fallback. -
Changed
Core_kernel.failwiths
(akaError.failwiths
) to require
its~here
argument. -
Added
ppx_let
syntaxlet%mapn
andlet%bindn
, for n-ary map and
bind. -
Renamed
Expect_test_helpers
asExpect_test_helpers_async
, and
renamedExpect_test_helpers_kernel
asExpect_test_helpers_core
.
Removed the inclusion ofExpect_test_helpers_core
in
Expect_test_helpers_async
. -
Increased Asyncâs default maximum number of open file descriptors
from 2^15 to 2^16. -
Moved most of
Core.Iobuf
to a standalone library,Iobuf
, that
depends only onCore_kernel
, and can be used in javascript. Moved
the rest ofCore.Iobuf
into a standalone library,Iobuf_unix
,
that depends onCore
.
New packages
-
accessor
(https://github.com/janestreet/accessor): A library that makes
it nicer to work with nested functional data structures. -
accessor_async
(https://github.com/janestreet/accessor_async): Accessors
for Async types, for use with the Accessor library. -
accessor_base
(https://github.com/janestreet/accessor_base): Accessors
for Base types, for use with the Accessor library. -
accessor_core
(https://github.com/janestreet/accessor_core): Accessors
for Core types, for use with the Accessor library. -
expect_test_helpers_async
(https://github.com/janestreet/expect_test_helpers_async):
Async helpers for writing expectation tests. -
expect_test_helpers_core
(https://github.com/janestreet/expect_test_helpers_core):
Helpers for writing expectation tests. -
higher_kinded
(https://github.com/janestreet/higher_kinded): A library
with an encoding of higher kinded types in OCaml. -
incr_dom_interactive
(https://github.com/janestreet/incr_dom_interactive):
A monad for composing chains of interactive UI elements. -
incr_dom_sexp_form
(https://github.com/janestreet/incr_dom_sexp_form):
A library for building forms that allow the user to edit complicated types. -
ppx_accessor
(https://github.com/janestreet/ppx_accessor): [@@deriving]
plugin to generate accessors for use with the Accessor libraries. -
ppx_fixed_literal
(https://github.com/janestreet/ppx_fixed_literal):
Simpler notation for fixed point literals. -
ppx_log
(https://github.com/janestreet/ppx_log): Ppx_sexp_message-like
extension nodes for lazily rendering log messages. -
ppx_string
(https://github.com/janestreet/ppx_string): ppx extension for
string interpolation. -
re2_stable
(https://github.com/janestreet/re2_stable): Re2_stable adds
an incomplete but stable serialization of Re2. -
vcaml
(https://github.com/janestreet/vcaml): OCaml bindings for the
Neovim API.
Deprecations / Removals
Async
:
-
Deleted functions that were deprecated in 2018 and earlier.
-
Deprecated the
Deferred.choice
type alias, in favor of
Deferred.Choice.t
. -
Removed
Pipe.init
, which has been deprecated since 2016. -
Deprecated
Throttle.Deferred
, which was a pointless alias for
Deferred
.
Core
:
- Removed the
Iobuf_debug
module.
Core_kernel
:
-
Deprecated the
Bug
exception. -
Made
Core_kernel
deprecate theUnix
module, recommending
Core.Unix
, withCaml_unix
as a fallback.
Moves
Core
:
-
Moved most of
Core.Iobuf
to a standalone library,Iobuf
, that
depends only onCore_kernel
, and can be used in javascript. Moved
the rest ofCore.Iobuf
into a standalone library,Iobuf_unix
,
that depends onCore
. -
Moved the
Bigstring
module out ofCore
to a standalone library,
Bigstring_unix
. -
Moved the
Linux_ext
module out ofCore
to a standalone library.
Core_kernel
:
-
Renamed
Fqueue
functions to be consistent withQueue
and
Fdeque
. -
Moved
Bus
to a standalone library.
Changelog
Async
:
- Deleted functions that were deprecated in 2018 and earlier.
Async_kernel
:
-
Added
Pipe.folding_filter_map'
function. -
Added
Synchronous_time_source.next_alarm_fires_at
function. -
Added
Synchronous_time_source.Event.Option
module, an immediate
option with support for optional syntax. -
Added
Pipe.concat_pipe
function. -
Added
Scheduler.run_every_cycle_end
, analogous to
run_every_cycle_start
. -
Exposed
Scheduler.Expert.last_cycle_num_jobs
function. -
Added
Async_kernel_scheduler.Expert
functionsrun_every_cycle_{start,end}
and
deprecatedset_on_{start,end}_of_cycle
. -
Added
Async_kernel_scheduler.last_cycle_time
accessor function. -
Deprecated the
Deferred.choice
type alias, in favor of
Deferred.Choice.t
. -
Exposed
Synchronous_time_source
function
Expert.max_alarm_time_in_min_timing_wheel_interval
. -
Optimized
Time_source.advance_by_alarms
and
Scheduler.yield_until_no_jobs_remain
to reduce the per-alarm cost
from ~660ns to ~140ns. Added toyield_until_no_jobs_remain
an
optional argument,?may_return_immediately:bool
to opt in to the
faster behavior. -
Fixed an issue with
Pipe.upstream_flushed
, so that its result does
not become determined if an exception happens while processing some
of the elements. -
Removed
Pipe.init
, which has been deprecated since 2016. -
Deprecated
Throttle.Deferred
, which was a pointless alias for
Deferred
.
Async_rpc_kernel
:
- Renamed
Pipe_rpc.Direct_stream_writer.Group.flushed
as
flushed_or_closed
, and changed it so that its result becomes
determined if the individual pipes are flushed or closed.
Async_rpc
:
- Added
Rpc.Connection.serve_inet
function, for synchronously
creating a TCP IP server.
Async_unix
:
-
Added
Tcp.Server.create_sock_inet
function, which is synchronous
and serves only inet addresses. -
Added
Tcp.Server.create_inet
function, for synchronously creating
a TCP IP server. -
In
Unix
functions that create aFile_descr.t
supplied
~close_on_exec:true
rather than callingset_close_on_exec
. -
Changed blocking
Sexp.save*
functions from@@deprecated
to
@@alert
. -
Made
Async_unix
shadowCore_kernel.eprint_s
, which can block. -
Added to the
Log.create
function a required unit argument, and an
optional argument to specify aSynchronous_time_source.t
. -
Made
Writer.flushed_*
functions consistently flush the synchronous
output channel if one is set. -
Fixed a bug in
Writer
error handling so that it calls
stopped_permanently
when the writer is not allowed to write due to
file-descriptor flags. -
Added to the
Log
module the ability to set atransform
function
applied to each message that is logged. -
Added
Unix
support forflock
, paralleling the existing support
forlockf
, and extended thewith_file
function to support both
mechanisms. Changed thelockf
functionsâ lock names fromRead | Write
toShared | Exclusive
. -
Added
Writer
functionsflushed_or_failed_*
, which, unlike
Writer.flushed
, return a result when the underlying writer fails. -
Fixed a race condition in
Shutdown.don't_finish_before
. -
Added to
Writer.with_file
an optional?syscall
argument. -
Improved
Fd
error messages forsyscall*
functions and
with_file_descr_deferred_exn
. -
Improved
Writer.with_file_atomic
's error message whenf
closes
t
. -
Increased Asyncâs default maximum number of open file descriptors
from 2^15 to 2^16. -
Fixed a race in
Writer.with_file_atomic
and thesave*
functions
that use it that could cause the file permissions to be incorrect. -
Fix a bug in
Shutdown.shutdown_on_unhandled_exn
where a process
would never shutdown ifDebug.log
raised (e.g. if stderr was a
broken pipe). -
Added to
Sys.when_file_changes
anon_exn
optional argument. -
Added
Process.send_signal
function that is safe against pid reuse. -
Added
Unix.waitpid_prompt
function, a version ofwaitpid
that
guarantees that itâs determined in the same async job where the
wait
system call is done.
Base
:
-
Fixed a bug in
Int.round_nearest
, which could overflow. -
Added
Hashtbl.Merge_into_action.t
type. -
Eliminated the
Base_boot
library,lib/base/boot
, by including
its ppx expansions directly in theBase
library,lib/base/src
. -
Changed
partition*
functions from using[ `Fst of 'a | `Snd of 'b ]
to using('a, 'b) Either.t
. -
Added
Hashtbl
functionsfind_and_call1
andfind_and_call2
,
aimed at avoiding allocation. -
Improved the
Gc
moduleâs deprecation message to recommend using
Caml.Gc
. -
Added
List.is_suffix
function. -
Added
Map.combine_errors
function. -
Added
Result
functionsto_either
andof_either
, and deprecated
ok_fst
. -
Added
Char.Caseless
submodule, analogous toString.Caseless
. -
Added
String.Caseless
functionsis_substring*
andsubstr*
, for
case-insensitive substring matching. -
Added the
Nothing
module, moved fromCore_kernel
. -
Added
Ref
functionsets_temporarily
, a generalization of
set_temporarily
to multiple refs. -
Changed
Float.min
andFloat.max
to never returnFloat.nan
, and
instead to always return one of the arguments. This improves
performance by avoiding allocation. -
Added
Option.try_with_join
. -
Added
Int_intf.S
functionsclz
andctz
, for leading and
trailing zeros in the binary representation of an int. -
Added
Nothing
module (moved fromCore_kernel
), which defines
type t = |
, the uninhabited type. -
Dropped support for OCaml < 4.07.
-
Added
Source_code_position.of_pos
, which allows you to create
Source_code_position.t
s from the OCaml built-inCaml.__POS__
special
value. -
Added
Sequence
functions to convert betweenSequence.t
and
Caml.Seq.t
. -
Added integer byte-swap functions,
bswap*
. -
Added
Set.are_disjoint
function. -
Added
String.Search_pattern
accessor functionspattern
and
case_sensitive
. -
Added
String
functionschop_{suffix,prefix}_if_exists
. -
Added
Comparable
functorsInfix
andPolymorphic_compare
, which
implement the comparisons in their eponymous signatures, and require
onlycompare
as input. -
Added
Blit.S1_distinct
interface, which allows thesrc
anddst
types to differ. -
Added
Uniform_array.iteri
function. -
Added
Map.validatei
function.
Bin_prot
:
- Updated functors
Binable.Of_sexpable
andBinable.Of_stringable
to take UUIDs.
Core
:
-
For
Unix
functions that create aFile_descr.t
, added an optional
argument,?close_on_exec:bool
, for atomic creation of
close-on-exec file descriptors. -
Added
Unix
functionflock_blocking
. -
Improved
Unix.create_process_env
's error message when it is called
with~prog_search_path:[]
. -
Removed the
Iobuf_debug
module. -
Added
Iobuf
functionscopy
andclone
. -
Moved most of
Core.Iobuf
to a standalone library,Iobuf
, that
depends only onCore_kernel
, and can be used in javascript. Moved
the rest ofCore.Iobuf
into a standalone library,Iobuf_unix
,
that depends onCore
. -
Added
Unix.Env
submodule, with typeUnix.Env.t = Unix.env
, and
exposed functions for manipulatingEnv.t
. -
Added
Filename
functionopen_temp_file_fd
, which is like
open_temp_file
but returns a file descriptor rather than an out
channel. -
Made
Time_ns.{Span,Ofday}.Option
matchQuickcheck.S
. -
Moved the
Bigstring
module out ofCore
to a standalone library,
Bigstring_unix
. -
Moved the
Linux_ext
module out ofCore
to a standalone library.
Core_kernel
:
-
Added
Bus.Callback_arity.Arity5
. -
Generalized
Univ_map
to support a user-supplied key type. -
Added
Gc.For_testing
submodule, with functions for measuring
allocation, previously inExpect_test_helpers_kernel
. -
Renamed
Fqueue
functions to be consistent withQueue
and
Fdeque
. -
Moved
Bus
to a standalone library. -
Added to
Option.Stable.V1.t
@@deriving equal
. -
Added to
Time_ns.Stable.V1
Map
andSet
modules. -
Replaced
Date
functionsadd_weekdays
andadd_business_days
with functions that clarify the behavior w.r.t. weekends. -
Fixed a bug in
Command.run
that caused incorrect calls in
let%test_unit
to mistakenly succeed. -
Added
Command.Auto_complete
submodule, naming the type of
Arg_type.create
's~complete
argument. -
Added
Date.Option
submodule,Immediate_option.S
. -
Added submodule
Percent.Option : Immediate_option.S_without_immediate
. -
Changed
Command.Param.choose_one
to disallow parameters which
donât have any CLI flags. -
Changed
Blang.or_
andBlang.and_
to make trees that
short-circuit more quickly by traversing fewerBlang.t
nodes at
eval
. -
Added to
Command.run
an optional argument,
?when_parsing_succeeds:(unit -> unit)
, which runs before the
programâs main thunk. -
Improved
Command.Param.choose_one
's error messages. -
Deprecated the
Bug
exception. -
Made
Core_kernel
deprecate theUnix
module, recommending
Core.Unix
, withCaml_unix
as a fallback. -
Added
Gc
functionallocated_words : unit -> int
. -
Changed
Core_kernel.failwiths
(akaError.failwiths
) to require
its~here
argument. -
Changed
Command
argument parsing so that--
is only interpreted
as a prefix of exactly--
, an in particular not a prefix of
--help
. -
Extended
String.Stable.V1
to matchStringable.S
. -
Added
Hash_queue
functionlookup_and_remove
. -
Add
Set
support for writingSet.V1.M(Elt).t
in stable types. -
Added
Byte_units.arg_type
. -
Extracted from
Command
theShape
-related code into a new file,
command_shape.ml
. -
Made
Date.Option
matchComparable.S_plain
and
Quickcheckable.S
. -
Added
Quickcheckable.Of_quickcheckable*
functors. -
Added
Time_ns.Ofday.every
function. -
Made
[@@deriving quickcheck]
work withBase
-style maps and and
sets, e.g.type t = int Map.M(String).t [@@deriving quickcheck]
. -
Added to
Command
support for validating a command line, via the
functionCommand_test_helpers.validate_command_line
. -
Added
Filename.to_absolute_exn
function. -
Updated
gc_stubs.c
to work better with OCaml 4.10. -
Exposed
Quickcheck.Shrinker.filter*
functions. -
Exposed the
Univ_map.Data
module type.
Expect_test_helpers
:
-
Generalized
print_and_check_container_sexps
so that it applies to
stable container modules. -
Fixed the handling of quickcheck shrinkers to print only the final
failing value, rather than every value that was tried and failed. -
Added Async analogs of
Ref.set_temporarily
andsets_temporarily
:
set_temporarily_async
,sets_temporarily_async
. -
Renamed
Expect_test_helpers
asExpect_test_helpers_async
, and
renamedExpect_test_helpers_kernel
asExpect_test_helpers_core
.
Removed the inclusion ofExpect_test_helpers_core
in
Expect_test_helpers_async
.
Expect_test_helpers_async
:
- Removed
Expect_test_helpers_async.Expect_test_config
.
Expect_test_helpers_base
:
-
Added functions
replace
andreplace_s
, for rewriting strings and
sexps in output. -
Added function
hide_temp_files_in_string
, for hiding temp file
names in expect-test output. -
Changed
require_sets_are_equal
to take a module matching
Comparator.S
rather than a fragment ofSet.S
, which better fits
withBase
idioms.
Incremental
:
-
Added function
node_value
, to get the current value of a node,
even if it is stale or invalid. -
Added support for syntaxes
let%mapn
andlet%bindn
. -
Added
Incremental.Var.replace
function, analogous to
Ref.replace
.
Linux_ext
:
- Added function
peer_credentials
, for using theSO_PEERCRED
socket option.
Stdio
:
- Optimized
In_channel.input_all
to eliminate an unnecessary copy
between buffers.
Timezone
:
- Added
Timezone
support in javascript.