Erlang/OTP 25.0 Release
May 18, 2022
· by Henrik Nord
Erlang/OTP 25 is a new major release with new features, improvements as well as a few incompatibilities.
For details about new features, bugfixes and potential incompatibilities see the Erlang 25.0 README or the Erlang/OTP 25.0 downloads page.
Many thanks to all contributors!
Erlang/OTP 25.0 Highlights #
stdlib #
- New function
filelib:ensure_path/1will ensure that all directories for the given path exists - New functions
groups_from_list/2andgroups_from_list/3in themapsmodule - New functions
uniq/1uniq/2in thelistsmodule - New PRNG added to the
randmodule, for fast pseudo-random numers.
compiler, kernel, stdlib, syntax_tools #
- Added support for selectable features as described in
EEP-60. Features can be enabled/disabled during compilation with options (ordinary and +term) toerlcas well as with directives in the file. Similar options can be used toerlfor enabling/disabling features allowed at runtime. The newmaybeexpressionEEP-49is fully supported as the feature maybe_expr.
erts & JIT #
- The JIT now works for 64-bit ARM processors.
- The JIT now does type-based optimizations based on type information in the BEAM files.
- Improved the JIT’s support for external tools like
perfandgdb, allowing them to show line numbers and even the original Erlang source code when that can be found.
erts, stdlib, kernel #
- Users can now configure ETS tables with the
{write_concurrency, auto}option. This option forces tables to automatically change the number of locks that are used at run-time depending on how much concurrency is detected. The{decentralized_counters, true}option is enabled by default when{write_concurrency, auto}is active.
Benchmark results comparing this option with the other ETS optimization options are available here: benchmarks. - To enable more optimizations, BEAM files compiled with OTP 21 and earlier cannot be loaded in OTP 25.
- The signal queue of a process with
the process flag
message_queue_data=off_heaphas been optimized to allow parallel reception of signals from multiple processes. This can improve performance when many processes are sending in parallel to one process. See benchmark. - The Erlang installation directory is now relocatable on the file system given that the paths in the installation’s RELEASES file are paths that are relative to the installations root directory.
- A new option called
shorthas been added to the functionserlang:float_to_list/2anderlang:float_to_binary/2. This option creates the shortest correctly rounded string representation of the given float that can be converted back to the same float again. - Introduction of
quote/1andunquote/1functions in theuri_stringmodule - a replacement for the deprecated functionshttp_uri:encodeandhttp_uri:decode. - The new module
peersupersedes theslavemodule. Theslavemodule is now deprecated and will be removed in OTP 27. globalwill now by default prevent overlapping partitions due to network issues. This is done by actively disconnecting from nodes that reports that they have lost connections to other nodes. This will cause fully connected partitions to form instead of leaving the network in a state with overlapping partitions.
It is possible to turn off the new behavior by setting the thekernelconfiguration parameterprevent_overlapping_partitionstofalse. Doing this will retain the same behavior as in OTP 24 and earlier.- The
format_status/2callback forgen_server,gen_statemandgen_eventhas been deprecated in favor of the newformat_status/1callback.
The new callback adds the possibility to limit and change many more things than the just the state. - The
timermodule has been modernized and made more efficient, which makes the timer server less susceptible to being overloaded. Thetimer:sleep/1function now accepts an arbitrarily large integer.
compiler #
- The
maybe ... endconstruction as proposed inEEP-49has been implemented. It can simplify complex code where otherwise deeply nested cases would have to be used.
To enablemaybe, give the option{enable_feature,maybe_expr}to the compiler. The exact option to use will change in a coming release candidate and then it will also be possible to use from inside the module being compiled. - When a record matching or record update fails, a
{badrecord, ExpectedRecordTag}exception used to be raised. In this release, the exception has been changed to{badrecord, ActualValue}, whereActualValueis the value that was found instead of the expected record. - Add compile attribute
-nifs()to empower compiler and loader with information about which functions may be overridden as NIFs byerlang:load_nif/2. - Improved and more detailed error messages when binary construction with the
binary syntax fails.
This applies both for error messages in the shell and for
erl_error:format_exception/3,4. - Change format of feature options and directives for better consistency.
Options to erlc and the
-compile(..)directive now has the format{feature, feature-name, enable | disable}. The-feature(..)now has the format-feature(feature-name, enable | disable).
crypto #
- Add
crypto:hash_equals/2which is a constant time comparision of hashvalues.
ssl #
- Introducing a new (still experimental) option
{certs_keys,[cert_key_conf()]}. With this a list of a certificates with their associated key may be used to authenticate the client or the server. The certificate key pair that is considered best and matches negotiated parameters for the connection will be selected.
public_key #
- Functions for retrieving OS provided CA-certs added.
dialyzer #
- Optimize operations in the
erl_typesmodule. Parallelize the Dialyzer pass remote. - Added the
missing_returnandextra_returnoptions to raise warnings when specifications differ from inferred types. These are similar to, but not quite as verbose as overspecs and underspecs. - Dialyzer now better understands the types for
min/2,max/2, anderlang:raise/3. Because of that, Dialyzer can potentially generate new warnings. In particular, functions that useerlang:raise/3could now need a spec with ano_return()return type to avoid an unwanted warning.
Misc #
- A new DEVELOPMENT HOWTO guide has been added that describes how to build and test Erlang/OTP when fixing bugs or developing new functionality.
- Testing has been added to the Github actions run for each opened PR so that more bugs are caught earlier when bug fixes and new features are proposed.
Download links for this and previous versions are found here