Releases: elixir-lang/elixir
v1.10.4
1. Bug fixes
Elixir
- [Kernel] Fix a bug where custom types were printed as built-in types
- [Kernel] Don't add compile-time dependency on
defdelegate
- [Kernel] Add line numbers to warnings on deprecated imports
- [Kernel] Report the correct line number when raising inside a macro
- [Task] Include callers in translated Logger metadata for Task
- [Task] Fix Task PID and caller in Task Supervisor reports
ExUnit
- [ExUnit.Formatter] Avoid crashes when diffing guards when the pattern does not match
- [ExUnit.Formatter] Also blame exceptions that come from linked and trapped exits
IEx
- [IEx.Helpers] Do not crash when printing a type that cannot be code formatted
Mix
- [mix app.start] Fix reading
.app
file located in archives (.ez
files) - [mix local.hex] Provide more guidance when Hex can't be installed
- [mix release] Properly encode config in releases
Checksums
- Precompiled.zip SHA1: 5b400c829c4f239ac89a7eb97aac642b961f38fd
- Precompiled.zip SHA512: 9727ae96d187d8b64e471ff0bb5694fcd1009cdcfd8b91a6b78b7542bb71fca59869d8440bb66a2523a6fec025f1d23394e7578674b942274c52b44e19ba2d43
- Docs.zip SHA1: 178f08724c63496878b6e427467f650f03cd978c
- Docs.zip SHA512: cefaf0371a9751d37d6d1181f910a23d6cc627f7b77fe7fa1b303a9b4769d1fb2a9bbeea54566109fa5acf8e0455a5a44cb3ac9ccb9e968d92610b869d15d27c
v1.10.3
1. Bug fixes
Elixir
- [Code] Return
[{mod, bin}]
fromCode.compile_file/2
,Code.require_file/2
,Code.load_file/2
- [Code] Make sure the formatter respects newlines before and after module attributes
- [Kernel.ParallelCompiler] Fix a bug where the parallel compiler would raise in long compilation cycles
- [Kernel.ParallelCompiler] Fix a bug where the parallel compiler would raise if some of the modules being compiled referred to a module that has been loaded directly to memory
- [Module] Fix accidental breaking change where bodiless clauses had their body value on
@on_definition
callbacks set to an empty list instead ofnil
- [String] Undeprecate
String.normalize/2
normalize and fix infinite loop caused by certain invalid strings
ExUnit
- [ExUnit.Assertions] Fix pattern matching diff when matching on pinned variables
- [ExUnit.Assertions] Fix pattern matching diff when matching variable struct names
- [ExUnit.Assertions] Fix pattern matching diff when matching on the binary concat operator (
<>
) and the left side is not a literal string - [ExUnit.Assertions] Fix pattern matching diff when matching on pseudo-vars (
__MODULE__
,__DIR__
, etc)
Mix
- [mix release] Respect the
:path
option when creating a:tar
file for releases
Checksums
- Precompiled.zip SHA1: 382fa22e6f184c0cc87fcfbfa0053c349d85f6f1
- Precompiled.zip SHA512: fc6d06ad4cc596b2b6e4f01712f718200c69f3b9c49c7d3b787f9a67b36482658490cf01109b0b0842fc9d88a27f64a9aba817231498d99fa01fa99688263d55
- Docs.zip SHA1: e417c3849bbc0371e805b3265dbbb21e3ef02d3f
- Docs.zip SHA512: 6ffb0376701570fc06ecc801c8151deec700b8636278834c0e3b06798418193da916e99de9644239347d5239915b2161e17d6a155723551d82eb212592adb9bf
v1.10.2
1. Bug fixes
Elixir
- [Macro] Fix a bug where
Macro.to_string/1
would emit invalid code for sigils - [Task] Do not crash
async_stream
monitor if it receives spurious DOWN messages
Logger
- [Logger] Fix a bug where the Logger formatter would fail when handling unknown metadata values
Mix
- [mix compile] Do not write files to disk if
--warnings-as-errors
was given and warnings were emitted
Checksums
- Precompiled.zip SHA1: 830264881231e711d8bade711ed2819a2d10b918
- Precompiled.zip SHA512: 532f43f08a29b5cbfca5a544c337b4a6d336d372ba0a5b3393681426d57ecaa85960e8eb3548aea26f213cc36914c6b66b83707cd719e27dc34c40efadb9f0b9
- Docs.zip SHA1: cca85f8f2dec9adbc52022d4666dd01bd0793424
- Docs.zip SHA512: c485dd315113cc13509bf47b4992f9e1825d433f5f5c923f22c792b100afa09e42ee7975c93c8d585bf58fce1713b50864c1fde829feda3c361335357b9b10ae
v1.10.1
1. Bug fixes
Elixir
- [Code] Do not emit invalid code when formatting
nil
,false
, andtrue
keys in maps - [Kernel] Ensure
with
clauses properly unpack "implicit guards" (such as matching on the struct name) - [Kernel] Do not warn if commas are used by themselves in
~w
/~W
sigils - [Kernel] Do not validate the
:line
option in quote (the validation has been moved to v1.11 to give users more time to update their code) - [Module] Ensure the code verifier handles the
:erlang.size/1
guard properly
Logger
- [Logger] Properly handle the
report_cb/2
option from Erlang - [Logger] Fix truncation for multi-byte characters
- [Logger] Do not rebroadcast messages from remote nodes as this is now taken care by Erlang's logger
ExUnit
- [ExUnit] Ensure
assert_receive
produces valid exception messages in case of errors
Mix
- [mix release] Make sure the install command (Window specific) works on paths with spaces in the name
- [mix release] Allow using
remote
andrpc
commands withApplication.compile_env/3
Checksums
- Precompiled.zip SHA1: 606ffaff6c7c3d278d7daa1fee653aa8183f225f
- Precompiled.zip SHA512: e8809aff909ca6e2271493690a6a095959e551f6d04e2d384ead0d6cfde23a3707492b53563b9a78080509b44728a63645dc37be108cd6ea3f9501f5d616fe1d
- Docs.zip SHA1: bb050e0b56a2d32562f7c876f8eed53846b857fe
- Docs.zip SHA512: be8ffec17cd15a439f78857eee615793d4d22a9b38b34df94d8546bb0f0b5745974115337cadcefebc82feef62d6f2d5a19f50f563f4efc9c9e4543815ccf85b
v1.10.0
Support for Erlang/OTP 21+
Elixir v1.10 requires Erlang/OTP 21+, allowing Elixir to integrate with Erlang/OTP's new logger. Currently, this means that the logger level, logger metadata, as well as all log messages are now shared between Erlang and Elixir APIs.
We will continue improving the relationship between the logging systems in future releases. In particular, we plan to expose all log levels and runtime filtering functionalities available in Erlang directly into Elixir in the next Elixir version.
This release also adds two new guards, is_struct/1
and is_map_key/2
, thanks to the strict requirement on Erlang/OTP 21+.
Releases improvements
Elixir v1.9 introduced releases as a mechanism to package self-contained applications. Elixir v1.10 further improves releases with bug fixes and new enhancements based on feedback we got from the community. The highlights are:
-
Allow the dual boot system of releases to be disabled on environments that are boot-time sensitive, such as embedded devices
-
Track and raise if compile-time configuration is set or changes at runtime (more in the next section)
-
Support for easily adding extra files to releases via overlays
-
Allow
RELEASE_DISTRIBUTION
to be set tonone
in order to fully disable it -
Add a built-in
:tar
step that automatically packages releases
See the full CHANGELOG for more improvements.
Improvements to sort-based APIs in Enum
Enum.sort/1
in Elixir by default sorts from lowest to highest:
iex> Enum.sort(["banana", "apple", "pineapple"])
["apple", "banana", "pineapple"]
If you want to sort from highest to lowest, you need to call Enum.sort/2
with a custom sorting function, such as Enum.sort(collection, &>=/2)
, which is not immediately obvious to someone reading the code:
iex> Enum.sort(["banana", "apple", "pineapple"], &>=/2)
["pineapple", "banana", "apple"]
Furthermore, comparison operators, such as <=
and >=
, perform structural sorting, instead of a semantic one. For example, using >=
to sort dates descendingly won't yield the correct result:
iex> Enum.sort([~D[2019-12-31], ~D[2020-01-01]])
[~D[2020-01-01], ~D[2019-12-31]]
To perform proper semantic comparison for dates, one would also need to pass a custom sorting function:
iex> Enum.sort([~D[2019-12-31], ~D[2020-01-01]], &(Date.compare(&1, &2) != :lt))
[~D[2019-12-31], ~D[2020-01-01]]
Elixir v1.10 streamlines the sorting functions by introducing both :asc
and :desc
shortcuts:
iex> Enum.sort(["banana", "apple", "pineapple"], :asc)
["apple", "banana", "pineapple"]
iex> Enum.sort(["banana", "apple", "pineapple"], :desc)
["pineapple", "banana", "apple"]
As well as adding the possibility to pass a module to perform semantic comparisons. For example, to sort dates, one now only needs to pass the Date
module or even {:desc, Date}
for descending semantical sort:
iex> Enum.sort([~D[2019-12-31], ~D[2020-01-01]], Date)
[~D[2019-12-31], ~D[2020-01-01]]
iex> Enum.sort([~D[2019-12-31], ~D[2020-01-01]], {:desc, Date})
[~D[2020-01-01], ~D[2019-12-31]]
These API improvements make the code more concise and readable and they have also been added to Enum.sort_by
, Enum.min_by
, Enum.max_by
, and friends.
Tracking of compile-time configuration
In Elixir, we organize our code in applications. Libraries, your dependencies, and your own project are all separate applications. All applications in Elixir also come with an application environment.
The application environment is a key-value store that allows us to configure said application. While reading the application environment at runtime is the preferred approach, in some rare occasions you may want to use the application environment to configure the compilation of a certain project. This is often done by calling Application.get_env/3
outside of a function:
defmodule MyApp.DBClient do
@db_host Application.get_env(:my_app, :db_host, "db.local")
def start_link() do
SomeLib.DBClient.start_link(host: @db_host)
end
end
This approach has one big limitation: if you change the value of the application environment after the code is compiled, the value used at runtime is not going to change! For example, if you are using mix release
and your config/releases.exs
has:
config :my_app, :db_host, "db.production"
Because config/releases.exs
is read after the code is compiled, the new value will have no effect as the code was compiled to connect to "db.local".
Of course, the obvious solution to this mismatch is to not read the application environment at compilation time in the first place, and instead move the code to inside a function:
defmodule MyApp.DBClient do
def start_link() do
SomeLib.DBClient.start_link(host: db_host())
end
defp db_host() do
Application.get_env(:my_app, :db_host, "db.local")
end
end
While this is the preferred approach, there are still two scenarios we need to address:
-
Not everyone may be aware of this pitfall, so they will mistakenly read the application environemnt at compile-time, until they are bitten by this behaviour
-
In rare occasions, you trully need to read the application environment at compile-time, and you want to be warned when you try to configure at runtime something that is valid only at compilation time
Elixir v1.10 aims to solve these two scenarios by introducing a Application.compile_env/3
function. For example, to read the value at compile time, you can now do:
@db_host Application.compile_env(:my_app, :db_host, "db.local")
By using compile_env/3
, Elixir will store the values used during compilation and compare them with the runtime values whenever your system starts, raising an error in case they differ. This helps developers ensure they are running their production systems with the configuration they intend to.
In future versions, we will deprecate the use Application.get_env
at compile-time with a clear message pointing users to configuration best practices, effectively addressing the scenario where users read from the application environment at compile time unaware of its pitfalls.
Compiler tracing
This release brings enhancements to the Elixir compiler and adds new capabilities for developers to listen to compilation events.
In previous Elixir versions, Elixir would compile a database of cross references between modules (such as function calls, references, structs, etc) for each project in order to perform all kinds of checks, such as deprecations and undefined functions.
Although this database was not public, developers would still use it to run their own checks against their projects. With time, developers would request more data to be included in the database, which was problematic as Elixir itself did not have a use for the additional data, and the database was not meant to be used externally in the first place.
In Elixir v1.10, we have addressed these problems by introducing compiler tracing. The compiler tracing allows developers to listen to events as they are emitted by the compiler, so they can store all of the information they need - and only the information they need.
Elixir itself is using the new compiler tracing to provide new functionality. One advantage of this approach is that developers can now disable undefined function warnings directly on the callsite. For example, imagine you have an optional dependency which may not be available in some cases. You can tell the compiler to skip warning on calls to optional modules with:
@compile {:no_warn_undefined, OptionalDependency}
defdelegate my_function_call(arg), to: OptionalDependency
Previously, this information had to be added to the overall project configuration, which was far away from where the optional call effectively happened.
Other enhancements
Elixir's calendar data types got many improvements, such as sigil support for third-party calendars, as well as the additions of DateTime.now!/2
, DateTime.shift_zone!/3
, and NaiveDateTime.local_now/0
.
There are many improvements related to Elixir's AST in this release too. First of all, Code.string_to_quoted/2
has two new options, :token_metadata
and :literal_encoder
, that give more control over Elixir's parser. This information was already available to the Elixir code formatter and has now been made public. We have also extensively documented all of Elixir's AST metadata. These changes alongside compiler tracing means static analyzers and IDE integrations have a better foundation to analyze the source code.
ExUnit, our test framework, ships two small but important improvements: ExUnit.CaptureIO
can now be used by tests that run concurrently and we have added "pattern-matching diffing". To understand the last feature, take this code:
assert %{"status" => 200, "body" => %{"key" => "foo"}} = json_payload
Now imagine that json_payload
is a large JSON blob and the "key"
inside the "body"
did not have value of "foo"
. In previous Elixir versions, if the assertion failed, Elixir would print the right side and let you up to your own devices to figure out what went wrong. In Elixir v1.10, we diff the data structure against the pattern so you can see exactly which parts of the data matched the pattern and which ones did not. Note ExUnit already performed diffing when comparing data types, this new version adds diffing when matching data agaainst a pattern.
CHANGELOG
1. Enhancements
Elixir
- [Application] Add
Application.compile_env/3
andApplication.compile_env!/2
for reading values at compilation time and tracking if they accidentally change during runtime - [Calendar] Allow custom calendar representations in calendar sigils
...
v1.10.0-rc.0
Checksums
- Precompiled.zip SHA1: ed80d00c3d805da50787f8dd9d0d02acf6ae5668
- Precompiled.zip SHA512: b878d802c9ad9d9d8ee2493c653d4e5335f68fce2c237e0e5c13c2af0c8855eb6219842b480b794fc3076606a4832c90932bed8262ce4c0164f5af6756f26997
- Docs.zip SHA1: c6fac84cca76c6ff9450e9dfc305e1db24ecee75
- Docs.zip SHA512: 3e4eaa181ab9cd002ff0dbdd4790a630e422fcbfd35d0fe10987bfac0ffa8ceeda313e1c06381063426ba02a63b44f959c5e4151663dcdd612e77a68a06888fa
v1.9.4
1. Bug fixes
Mix
- [mix local.hex] Remove invalid deprecation warning on
mix local.hex
command
Checksums
- Precompiled.zip SHA1: ec4c7d15b28373b8fd7025b4502b7f2036229f20
- Precompiled.zip SHA512: f86170bde3b3ad3d1365f34f77ab9cb424c4638a4067fd7d509787c03dea0d40061ef1a2c8d1d9e42bec65b8cda8c1bf32801e4712531eeaef50e0cd53ac2369
- Docs.zip SHA1: 3c7496c77c9ce303d1b9eceb036ec2e8154f6347
- Docs.zip SHA512: b7f9efad208e52432302a04799a66f10ea217ecc01eae056c1204e17cc5ce232780c1b9c8b50a33004b180f1bc51a86b9de5ef8502c1428e9c2b50050f0ebe60
v1.9.3
This release deprecates the use of URLs on mix archive.install
, mix escript.install
, and mix local.rebar
. Support for passing URLs to said commands will be fully removed on Elixir v1.10, as they are unsafe. Thanks to Bram Verburg for the report and for providing a fix.
The alternative is straight-forward: you can simply download the artifact via the command line and then invoke the command with a file system path. For example, instead of:
$ mix archive.install https://example.org/installer.ez
You can execute on Unix (Linux, MacOS X):
$ wget https://example.org/installer.ez
$ mix archive.install installer.ez
or
$ curl -o installer.ez https://example.org/installer.ez
$ mix archive.install installer.ez
On Windows (Win7 or later):
> powershell -Command "Invoke-WebRequest https://example.org/installer.ez -OutFile installer.ez"
> mix archive.install installer.ez
or
> powershell -Command "(New-Object Net.WebClient).DownloadFile('https://example.org/installer.ez', 'installer.ez')"
> mix archive.install installer.ez
Note that, if you are a library author, consider providing installable escripts and archives through Hex, such as Phoenix:
$ mix archive.install hex phx_new
Installations through Hex are always safe and they come with version management and all other benefits from Hex too.
1. Enhancements
Mix
- [mix release] Add :tar option for releases to create a tarball
2. Bug fixes
Mix
- [mix release] Use
default_release
option when name is not given - [mix release] Make release's boot script contents deterministic
3. Deprecations
Mix
- [mix archive.install] Warn when installing from URI
- [mix escript.install] Warn when installing from URI
- [mix local.rebar] Warn when installing from URI
Checksums
- Precompiled.zip SHA1: 8bcf1cca9a946db02af570a78b007e9424cd933f
- Precompiled.zip SHA512: e5252721b5a08f48c5988027cb765f9317e7e271e52f3f4a3ebcb77581eb584c9aa0cdb216e12a3d626f725964fde2af84ce2241ac8b04d034dd461206c17f54
- Docs.zip SHA1: a7935d18ec5a04dd7a3e631483e31b6fbe6a8b1d
- Docs.zip SHA512: 59a53ed8a83920afaf087ecd6edb39a6401d9c917a113ce0ea7ad05612a33f35f188e3673e50c7b068b614c6121461095b32a4385d9a838e8b6461274a9ac6d6
v1.9.2
1. Enhancements
Mix
- [mix release] Allow
{:from_app, app_name}
as a version for releases
2. Bug fixes
Elixir
- [Kernel] Ensure compilation works for a variable named
super
- [Kernel] Ensure capture operator of a local function expands correctly inside a macro
- [Regex] Ensure dynamic recompilation of regexes considers options. This fixes an issue where parsing the protocol in
URI.parse/1
seemingly looked case sensitive when running Elixir precompiled on another machine
Mix
- [mix release] Use
Base.encode32
when generating cookie to avoid unsafe chars - [mix release] Fix
install
command on Windows - [mix release] Quote executable path on Windows to ensure it works on directories with spaces
Checksums
- Precompiled.zip SHA1: d638cbc2a30a3ffd9b842e19c2cad62e9c3f303b
- Precompiled.zip SHA512: 21f5fd086ec68b180857a839fdf0edfb594f33c85ce3fd9bdf5ec9122ee5513244bb3dd2d6c20ba3f162705cf26e89a79033e7938c370c6b7393bfe5aff288c9
- Docs.zip SHA1: 9fe4d74a23106db59070d7c14498271390554c7f
- Docs.zip SHA512: e70d5b00176d02a1f51dd4da5a01b514d2318ecd8891e3ce8bba20b2651a690e3643df042dee33b0e6270ffbab999f859c1a2d8df984d897604a8c57629dac09
v1.9.1
1. Enhancements
Mix
- [mix format] Print relative paths in
--check-formatted
output - [mix release] Support included applications
2. Bug fixes
Elixir
- [Code] Fix formatter wrongly removing nested parens in nested calls
Logger
- [Logger] Do not crash translator on poorly formatted supervisor names
Mix
- [mix compile] Raise readable error for mismatched sources during compilation
- [mix release] Preserve UTF8 encoding in release config files
Checksums
- Precompiled.zip SHA1: 51520d0edf924f3c4620739cf2009d545eab6e99
- Precompiled.zip SHA512: 14826fe295c19c9e331f2777f70a13ae55bf107ce043d0aeb747b5235de82bd6175c915f0bea63ffe0f87136357d76522c67bdd54fc61dd1f167afb4879a3845
- Docs.zip SHA1: ccaf7a52c586b9730d4cabe1482ec75c30676975
- Docs.zip SHA512: e0cfdfb2280d8696e534c627fd3b2f90a010cb6417a4e66b63663968335d82c01f30da8912932ebb6673fe726c059cd9e41a89e84cb49fe9868020e3eeddf04e