Erlang/OTP 29.0
Erlang/OTP 29.0
Erlang/OTP 29.0 May 13, 2026 · by Henrik Nord Erlang/OTP 29.0 2026年5月13日 · 作者:Henrik Nord
OTP 29.0 # Erlang/OTP 29 is a new major release with new features, improvements as well as a few incompatibilities. Some of the new features are highlighted below. Many thanks to all contributors! OTP 29.0 # Erlang/OTP 29 是一个全新的重大版本,包含新功能、改进以及少量不兼容变更。以下重点介绍部分新功能。衷心感谢所有贡献者!
Highlights # Added support for -unsafe attributes for marking functions as unsafe to use. The compiler will by default now generate warnings for calls to functions in Erlang/OTP known to be always unsafe. Furthermore, xref can now be used to find calls to unsafe functions and functions that lack documentation.
亮点 # 增加了对 -unsafe 属性的支持,用于标记不安全的函数。编译器现在默认会对调用 Erlang/OTP 中已知始终不安全的函数发出警告。此外,现在可以使用 xref 来查找对不安全函数以及缺乏文档的函数的调用。
The SSH daemon now defaults to disabled for shell and exec services, implementing the “secure by default” principle. This prevents authenticated users from executing arbitrary Erlang code unless explicitly configured. The SFTP subsystem is no longer enabled by default when starting an SSH daemon. SSH 守护进程现在默认禁用 shell 和 exec 服务,以实现“默认安全”原则。这防止了已认证用户在未明确配置的情况下执行任意 Erlang 代码。启动 SSH 守护进程时,SFTP 子系统也不再默认启用。
In SSL, the post quantum hybrid algorithm x25519mlkem768 is now the most preferred key exchange group in the default configuration.
在 SSL 中,后量子混合算法 x25519mlkem768 现在是默认配置中最优先的密钥交换组。
The module io_ansi allows the user to emit Virtual Terminal Sequences (also known as ANSI sequences) to the terminal in order to add colors/styling to text or to create fully fledged terminal applications.
io_ansi 模块允许用户向终端发送虚拟终端序列(也称为 ANSI 序列),以便为文本添加颜色/样式,或创建功能完备的终端应用程序。
The new ct_doctest module allows the user to test documentation examples in Erlang module docs and documentation files.
新的 ct_doctest 模块允许用户测试 Erlang 模块文档和文档文件中的示例。
The ignore_xref attribute has been handled as a post-analysis filter by build tools such as Rebar3. In this release, [xref] itself does the filtering, ensuring that all tooling that calls xref for any purpose can rely on these declarations to just work.
ignore_xref 属性此前由 Rebar3 等构建工具作为后分析过滤器处理。在此版本中,xref 本身负责过滤,确保所有调用 xref 的工具都能依赖这些声明并正常工作。
General # In the default code path for the Erlang system, the current working directory (.) is now in the last position instead of the first. There is no longer a 32-bit Erlang/OTP build for Windows. 常规 # 在 Erlang 系统的默认代码路径中,当前工作目录 (.) 现在位于最后一位,而不是第一位。Windows 平台不再提供 32 位 Erlang/OTP 构建版本。
New language features # Native records as described in EEP-79 has been implemented. A native record is a data structure similar to the traditional tuple-based records, except that is a true data type. Native records are considered experimental in Erlang/OTP 29 and possibly also in Erlang/OTP 30. 新语言特性 # 实现了 EEP-79 中描述的原生记录(Native records)。原生记录是一种类似于传统基于元组的记录的数据结构,但它是一种真正的数据类型。原生记录在 Erlang/OTP 29 中被视为实验性功能,可能在 Erlang/OTP 30 中亦是如此。
The new is_integer/3 guard BIF makes it possible to easily verify that a value is both an integer and within a certain range. For example: is_integer(I, 0, 100)
新的 is_integer/3 守卫 BIF 可以轻松验证一个值是否为整数且处于特定范围内。例如:is_integer(I, 0, 100)。
Multi-valued comprehensions according to EEP 78 are now supported. For example, [-I, I || I <- [1, 2, 3]] will produce [-1,1,-2,2,-3,3].
现在支持根据 EEP 78 实现的多值推导(Multi-valued comprehensions)。例如,[-I, I || I <- [1, 2, 3]] 将产生 [-1,1,-2,2,-3,3]。
By enabling the compr_assign feature, it is now possible to bind variables in a comprehensions. For example: [H || E <- List, H = erlang:phash2(E), H rem 10 =:= 0]
通过启用 compr_assign 特性,现在可以在推导式中绑定变量。例如:[H || E <- List, H = erlang:phash2(E), H rem 10 =:= 0]。
Compiler and JIT improvements # In the documentation for the [compile] module, there is now a section with recommendations for implementors of languages running on the BEAM. The JIT now generates better code for matching or creating binaries with multiple little-endian segments. The compiler will generate more efficient code for map comprehensions with constant values that don’t depend on the generator. Example: #{K => 42 || K <- List}
编译器和 JIT 改进 # 在 compile 模块的文档中,现在增加了一个章节,为在 BEAM 上运行的语言实现者提供建议。JIT 现在能为匹配或创建包含多个小端序段的二进制数据生成更好的代码。编译器将为不依赖于生成器的常量值的映射推导式生成更高效的代码。示例:#{K => 42 || K <- List}。
Compiler warnings # There are several new compiler warnings enabled by default. For each such warning, there is an option to disable it. There will now be a warning when using the catch operator, which has been deprecated for a long time. It is recommended to instead use try…catch but is also possible to disable the warning by using the nowarn_deprecated_catch option.
编译器警告 # 默认启用了几个新的编译器警告。每个警告都有相应的禁用选项。现在使用 catch 操作符时会发出警告,该操作符已被弃用很长时间。建议改用 try…catch,但也可以通过使用 nowarn_deprecated_catch 选项来禁用此警告。
There will now be a warning when exporting variables out of a subexpression. For example: file:open(File, AllOpts = [write, {encoding,utf8}]). This warning can be disabled using the nowarn_export_var_subexpr compiler option.
现在,当从子表达式中导出变量时会发出警告。例如:file:open(File, AllOpts = [write, {encoding,utf8}])。此警告可以使用 nowarn_export_var_subexpr 编译器选项禁用。
The compiler will now warn for uses of the and and or operators. This warning can be disabled using the nowarn_obsolete_bool_op compiler option.
编译器现在会对使用 and 和 or 操作符发出警告。此警告可以使用 nowarn_obsolete_bool_op 编译器选项禁用。
The compiler will now warn for matches such as {a,B} = {X,Y}, which is better written as {a=X,B=Y}. This warning can be disabled using the nowarn_match_alias_pats option.
编译器现在会对类似 {a,B} = {X,Y} 的匹配发出警告,这种写法最好写成 {a=X,B=Y}。此警告可以使用 nowarn_match_alias_pats 选项禁用。
For a long time, there has been a warning for using the obsolete guard tests (such as list(L) instead of is_list(L). In Erlang/OTP 30, the old guards will be removed from the language.
长期以来,使用过时的守卫测试(例如使用 list(L) 而非 is_list(L))一直会触发警告。在 Erlang/OTP 30 中,这些旧的守卫将被从语言中移除。
STDLIB # There are new functions for randomly permutating a list: rand:shuffle/1 and rand:shuffle_s/2.
STDLIB # 新增了用于随机排列列表的函数:rand:shuffle/1 和 rand:shuffle_s/2。
SSH # The default key exchange algorithm is now mlkem768x25519-sha256, a hybrid quantum-resistant algorithm combining ML-KEM-768 with X25519. This provides protection against both classical and quantum computer attacks while maintaining backward compatibility through automatic fallback to other algorithms when peers don’t support it.
SSH # 默认密钥交换算法现在是 mlkem768x25519-sha256,这是一种结合了 ML-KEM-768 和 X25519 的混合抗量子算法。它在提供针对经典计算机和量子计算机攻击保护的同时,通过在对端不支持时自动回退到其他算法,保持了向后兼容性。
For a full list and more details about new features and potential incompatibilities see the README. 有关新功能和潜在不兼容性的完整列表及更多详细信息,请参阅 README。