Skip to content

Commit 9e10ea8

Browse files
committed
Update CHANGELOG
1 parent 64f69cf commit 9e10ea8

File tree

1 file changed

+41
-1
lines changed

1 file changed

+41
-1
lines changed

CHANGELOG.md

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,21 @@ This release makes it so modules are loaded lazily. This reduces the pressure on
128128

129129
Implementation wise, [the parallel compiler already acts as a mechanism to resolve modules during compilation](https://elixir-lang.org/blog/2012/04/24/a-peek-inside-elixir-s-parallel-compiler/), so we built on that. By making sure the compiler controls both module compilation and module loading, it can also better guarantee deterministic builds.
130130

131-
The only potential regression in this approach happens if you have a module, which is used at compile time and defines an `@on_load` callback (typically used for [NIFs](https://www.erlang.org/doc/system/nif.html)) that invokes another modules within the same project. For example:
131+
There are two potential regressions with this approach. The first one happens if you spawn processes during compilation which invoke other modules defined within the same project. For example:
132+
133+
```elixir
134+
defmodule MyLib.SomeModule do
135+
list = [...]
136+
137+
Task.async_stream(list, fn item ->
138+
MyLib.SomeOtherModule.do_something(item)
139+
end)
140+
end
141+
```
142+
143+
Because the spawned module is not visible by the compiler, it won't be able to load `MyLib.SomeOtherModule`. You have two options, either use `Kernel.ParallelCompiler.pmap/2` or explicitly call `Code.ensure_loaded!(MyLib.SomeOtherModule)` before spawning the process that uses said module.
144+
145+
The second one is related to `@on_load` callbacks (typically used for [NIFs](https://www.erlang.org/doc/system/nif.html)) that invoke other modules defined within the same project. For example:
132146

133147
```elixir
134148
defmodule MyLib.SomeModule do
@@ -148,6 +162,8 @@ MyLib.SomeModule.something_else()
148162

149163
The reason this fails is because `@on_load` callbacks are invoked within the code server and therefore they have limited ability to load additional modules. It is generally advisable to limit invocation of external modules during `@on_load` callbacks but, in case it is strictly necessary, you can set `@compile {:autoload, true}` in the invoked module to address this issue in a forward and backwards compatible manner.
150164

165+
Both snippets above could actually lead to non-deterministic compilation in the past, and as a result of these changes, compilating these cases are now deterministic.
166+
151167
### Parallel compilation of dependencies
152168

153169
This release introduces a variable called `MIX_OS_DEPS_COMPILE_PARTITION_COUNT`, which instructs `mix deps.compile` to compile dependencies in parallel.
@@ -183,6 +199,30 @@ The outer list is the first element, the first nested list is the second, follow
183199

184200
Given this may reduce the amount of data printed by default, the default limit has also been increased from 50 to 100. We may further increase it in upcoming releases based on community feedback.
185201

202+
## Erlang/OTP 28 support
203+
204+
Elixir v1.19 officially supports Erlang/OTP 28.1+ and later. In order to support the new Erlang/OTP 28 representation for regular expressions, structs can now control how they are escaped by defining a `__escape__/1` callback that must return AST.
205+
206+
On the other, the new representation for regular expressions implies they can no longer be used as default values for struct fields. Instead of this:
207+
208+
```elixir
209+
defmodule Foo do
210+
defstruct regex: ~r/foo/
211+
end
212+
```
213+
214+
You must do this:
215+
216+
```elixir
217+
defmodule Foo do
218+
defstruct [:regex]
219+
220+
def new do
221+
%Foo{regex: ~r/foo/}
222+
end
223+
end
224+
```
225+
186226
## OpenChain certification
187227

188228
Elixir v1.19 is also our first release following OpenChain compliance, [as previously announced](https://elixir-lang.org/blog/2025/02/26/elixir-openchain-certification/). In a nutshell:

0 commit comments

Comments
 (0)