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_protfunctorsBinable.Of_sexpableand
Binable.Of_stringableto take UUIDs. -
Changed
BaseandCorepartition*functions from using[ `Fst of 'a | `Snd of 'b ]to using('a, 'b) Either.t. -
Replaced
Datefunctionsadd_weekdaysandadd_business_days
with functions that clarify the behavior w.r.t. weekends. -
Added syntax
while%bind, analogous toif%bind. -
Added to the
Async.Log.createfunction a required unit argument,
and an optional argument to specify aSynchronous_time_source.t. -
Made
Core_kerneldeprecate theUnixmodule, recommending
Core.Unix, withCaml_unixas a fallback. -
Changed
Core_kernel.failwiths(akaError.failwiths) to require
its~hereargument. -
Added
ppx_letsyntaxlet%mapnandlet%bindn, for n-ary map and
bind. -
Renamed
Expect_test_helpersasExpect_test_helpers_async, and
renamedExpect_test_helpers_kernelasExpect_test_helpers_core.
Removed the inclusion ofExpect_test_helpers_corein
Expect_test_helpers_async. -
Increased Asyncâs default maximum number of open file descriptors
from 2^15 to 2^16. -
Moved most of
Core.Iobufto a standalone library,Iobuf, that
depends only onCore_kernel, and can be used in javascript. Moved
the rest ofCore.Iobufinto 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.choicetype 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_debugmodule.
Core_kernel:
-
Deprecated the
Bugexception. -
Made
Core_kerneldeprecate theUnixmodule, recommending
Core.Unix, withCaml_unixas a fallback.
Moves
Core:
-
Moved most of
Core.Iobufto a standalone library,Iobuf, that
depends only onCore_kernel, and can be used in javascript. Moved
the rest ofCore.Iobufinto a standalone library,Iobuf_unix,
that depends onCore. -
Moved the
Bigstringmodule out ofCoreto a standalone library,
Bigstring_unix. -
Moved the
Linux_extmodule out ofCoreto a standalone library.
Core_kernel:
-
Renamed
Fqueuefunctions to be consistent withQueueand
Fdeque. -
Moved
Busto 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_atfunction. -
Added
Synchronous_time_source.Event.Optionmodule, an immediate
option with support for optional syntax. -
Added
Pipe.concat_pipefunction. -
Added
Scheduler.run_every_cycle_end, analogous to
run_every_cycle_start. -
Exposed
Scheduler.Expert.last_cycle_num_jobsfunction. -
Added
Async_kernel_scheduler.Expertfunctionsrun_every_cycle_{start,end}and
deprecatedset_on_{start,end}_of_cycle. -
Added
Async_kernel_scheduler.last_cycle_timeaccessor function. -
Deprecated the
Deferred.choicetype alias, in favor of
Deferred.Choice.t. -
Exposed
Synchronous_time_sourcefunction
Expert.max_alarm_time_in_min_timing_wheel_interval. -
Optimized
Time_source.advance_by_alarmsand
Scheduler.yield_until_no_jobs_remainto reduce the per-alarm cost
from ~660ns to ~140ns. Added toyield_until_no_jobs_remainan
optional argument,?may_return_immediately:boolto 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.flushedas
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_inetfunction, for synchronously
creating a TCP IP server.
Async_unix:
-
Added
Tcp.Server.create_sock_inetfunction, which is synchronous
and serves only inet addresses. -
Added
Tcp.Server.create_inetfunction, for synchronously creating
a TCP IP server. -
In
Unixfunctions that create aFile_descr.tsupplied
~close_on_exec:truerather than callingset_close_on_exec. -
Changed blocking
Sexp.save*functions from@@deprecatedto
@@alert. -
Made
Async_unixshadowCore_kernel.eprint_s, which can block. -
Added to the
Log.createfunction 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
Writererror handling so that it calls
stopped_permanentlywhen the writer is not allowed to write due to
file-descriptor flags. -
Added to the
Logmodule the ability to set atransformfunction
applied to each message that is logged. -
Added
Unixsupport forflock, paralleling the existing support
forlockf, and extended thewith_filefunction to support both
mechanisms. Changed thelockffunctionsâ lock names fromRead | WritetoShared | Exclusive. -
Added
Writerfunctionsflushed_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_filean optional?syscallargument. -
Improved
Fderror messages forsyscall*functions and
with_file_descr_deferred_exn. -
Improved
Writer.with_file_atomic's error message whenfcloses
t. -
Increased Asyncâs default maximum number of open file descriptors
from 2^15 to 2^16. -
Fixed a race in
Writer.with_file_atomicand thesave*functions
that use it that could cause the file permissions to be incorrect. -
Fix a bug in
Shutdown.shutdown_on_unhandled_exnwhere a process
would never shutdown ifDebug.lograised (e.g. if stderr was a
broken pipe). -
Added to
Sys.when_file_changesanon_exnoptional argument. -
Added
Process.send_signalfunction that is safe against pid reuse. -
Added
Unix.waitpid_promptfunction, a version ofwaitpidthat
guarantees that itâs determined in the same async job where the
waitsystem call is done.
Base:
-
Fixed a bug in
Int.round_nearest, which could overflow. -
Added
Hashtbl.Merge_into_action.ttype. -
Eliminated the
Base_bootlibrary,lib/base/boot, by including
its ppx expansions directly in theBaselibrary,lib/base/src. -
Changed
partition*functions from using[ `Fst of 'a | `Snd of 'b ]to using('a, 'b) Either.t. -
Added
Hashtblfunctionsfind_and_call1andfind_and_call2,
aimed at avoiding allocation. -
Improved the
Gcmoduleâs deprecation message to recommend using
Caml.Gc. -
Added
List.is_suffixfunction. -
Added
Map.combine_errorsfunction. -
Added
Resultfunctionsto_eitherandof_either, and deprecated
ok_fst. -
Added
Char.Caselesssubmodule, analogous toString.Caseless. -
Added
String.Caselessfunctionsis_substring*andsubstr*, for
case-insensitive substring matching. -
Added the
Nothingmodule, moved fromCore_kernel. -
Added
Reffunctionsets_temporarily, a generalization of
set_temporarilyto multiple refs. -
Changed
Float.minandFloat.maxto 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.Sfunctionsclzandctz, for leading and
trailing zeros in the binary representation of an int. -
Added
Nothingmodule (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.ts from the OCaml built-inCaml.__POS__special
value. -
Added
Sequencefunctions to convert betweenSequence.tand
Caml.Seq.t. -
Added integer byte-swap functions,
bswap*. -
Added
Set.are_disjointfunction. -
Added
String.Search_patternaccessor functionspatternand
case_sensitive. -
Added
Stringfunctionschop_{suffix,prefix}_if_exists. -
Added
ComparablefunctorsInfixandPolymorphic_compare, which
implement the comparisons in their eponymous signatures, and require
onlycompareas input. -
Added
Blit.S1_distinctinterface, which allows thesrcanddst
types to differ. -
Added
Uniform_array.iterifunction. -
Added
Map.validateifunction.
Bin_prot:
- Updated functors
Binable.Of_sexpableandBinable.Of_stringable
to take UUIDs.
Core:
-
For
Unixfunctions that create aFile_descr.t, added an optional
argument,?close_on_exec:bool, for atomic creation of
close-on-exec file descriptors. -
Added
Unixfunctionflock_blocking. -
Improved
Unix.create_process_env's error message when it is called
with~prog_search_path:[]. -
Removed the
Iobuf_debugmodule. -
Added
Iobuffunctionscopyandclone. -
Moved most of
Core.Iobufto a standalone library,Iobuf, that
depends only onCore_kernel, and can be used in javascript. Moved
the rest ofCore.Iobufinto a standalone library,Iobuf_unix,
that depends onCore. -
Added
Unix.Envsubmodule, with typeUnix.Env.t = Unix.env, and
exposed functions for manipulatingEnv.t. -
Added
Filenamefunctionopen_temp_file_fd, which is like
open_temp_filebut returns a file descriptor rather than an out
channel. -
Made
Time_ns.{Span,Ofday}.OptionmatchQuickcheck.S. -
Moved the
Bigstringmodule out ofCoreto a standalone library,
Bigstring_unix. -
Moved the
Linux_extmodule out ofCoreto a standalone library.
Core_kernel:
-
Added
Bus.Callback_arity.Arity5. -
Generalized
Univ_mapto support a user-supplied key type. -
Added
Gc.For_testingsubmodule, with functions for measuring
allocation, previously inExpect_test_helpers_kernel. -
Renamed
Fqueuefunctions to be consistent withQueueand
Fdeque. -
Moved
Busto a standalone library. -
Added to
Option.Stable.V1.t@@deriving equal. -
Added to
Time_ns.Stable.V1MapandSetmodules. -
Replaced
Datefunctionsadd_weekdaysandadd_business_days
with functions that clarify the behavior w.r.t. weekends. -
Fixed a bug in
Command.runthat caused incorrect calls in
let%test_unitto mistakenly succeed. -
Added
Command.Auto_completesubmodule, naming the type of
Arg_type.create's~completeargument. -
Added
Date.Optionsubmodule,Immediate_option.S. -
Added submodule
Percent.Option : Immediate_option.S_without_immediate. -
Changed
Command.Param.choose_oneto 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.tnodes at
eval. -
Added to
Command.runan 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
Bugexception. -
Made
Core_kerneldeprecate theUnixmodule, recommending
Core.Unix, withCaml_unixas a fallback. -
Added
Gcfunctionallocated_words : unit -> int. -
Changed
Core_kernel.failwiths(akaError.failwiths) to require
its~hereargument. -
Changed
Commandargument parsing so that--is only interpreted
as a prefix of exactly--, an in particular not a prefix of
--help. -
Extended
String.Stable.V1to matchStringable.S. -
Added
Hash_queuefunctionlookup_and_remove. -
Add
Setsupport for writingSet.V1.M(Elt).tin stable types. -
Added
Byte_units.arg_type. -
Extracted from
CommandtheShape-related code into a new file,
command_shape.ml. -
Made
Date.OptionmatchComparable.S_plainand
Quickcheckable.S. -
Added
Quickcheckable.Of_quickcheckable*functors. -
Added
Time_ns.Ofday.everyfunction. -
Made
[@@deriving quickcheck]work withBase-style maps and and
sets, e.g.type t = int Map.M(String).t [@@deriving quickcheck]. -
Added to
Commandsupport for validating a command line, via the
functionCommand_test_helpers.validate_command_line. -
Added
Filename.to_absolute_exnfunction. -
Updated
gc_stubs.cto work better with OCaml 4.10. -
Exposed
Quickcheck.Shrinker.filter*functions. -
Exposed the
Univ_map.Datamodule type.
Expect_test_helpers:
-
Generalized
print_and_check_container_sexpsso 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_temporarilyandsets_temporarily:
set_temporarily_async,sets_temporarily_async. -
Renamed
Expect_test_helpersasExpect_test_helpers_async, and
renamedExpect_test_helpers_kernelasExpect_test_helpers_core.
Removed the inclusion ofExpect_test_helpers_corein
Expect_test_helpers_async.
Expect_test_helpers_async:
- Removed
Expect_test_helpers_async.Expect_test_config.
Expect_test_helpers_base:
-
Added functions
replaceandreplace_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_equalto take a module matching
Comparator.Srather than a fragment ofSet.S, which better fits
withBaseidioms.
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%mapnandlet%bindn. -
Added
Incremental.Var.replacefunction, analogous to
Ref.replace.
Linux_ext:
- Added function
peer_credentials, for using theSO_PEERCRED
socket option.
Stdio:
- Optimized
In_channel.input_allto eliminate an unnecessary copy
between buffers.
Timezone:
- Added
Timezonesupport in javascript.
