4  Upcoming Potential Incompatibilities

4 Upcoming Potential Incompatibilities

This document lists planned upcoming potential incompatibilities in Erlang/OTP.

As of OTP 27, the functions erlang:fun_info/1,2 will always say that the local init process created all funs, regardless of which process or node the fun was originally created on.

In OTP 28, the {pid,_}element will be removed altogether.

As of OTP 27, the maybe_expr feature will be approved and enabled by default. That means that code that uses the unquoted atom maybe will fail to compile. All uses of maybe as an atom will need to be quoted. Alternatively, as a short-term solution, the maybe_expr feature can be disabled.

It is recommend to quote all uses of the atom maybe as soon as possible. The compiler option warn_keywords can be used to emit warnings about all occurrences of maybe without quotes.

The functionality of module re is currently provided by the PCRE library, which is no longer actively maintained. Therefore, in OTP 27, we will switch to a different regular expression library.

The source code for PCRE used by the re module has been modified by the OTP team to ensure that a regular expression match would yield when matching huge input binaries and/or when using demanding (back-tracking) regular expressions. Because of the those modifications, moving to a new version of PCRE has always been a time-consuming process because all of the modifications had to be applied by hand again to the updated PCRE source code.

Most likely, the new regular expression library will be RE2. RE2 guarantees that the match time is linear in the length of input string, and it also eschews recursion to avoid stack overflow. That should make it possible to use RE2 without modifying its source code. For more information about why RE2 is a good choice, see WhyRE2.

Some of implications of this change are:

  • We expect that the functions in the re module will continue to be supported, although some of the options are likely to be dis-continued.

  • It is likely that only pattern matching of UTF8-encoded binaries will be supported (not Latin1-encoded binaries).

  • In order to guarantee the linear-time performance, RE2 does not support all the constructs in regular expression patterns that PCRE do. For example, backreferences and look-around assertions are not supported. See Syntax for a description of what RE2 supports.

  • Compiling a regular expression is likely to be slower, and thus more can be gained by explicitly compiling the regular expression before matching with it.

As of OTP 28, the function erlang:fun_info/1 will not include the {pid,_} element and the function erlang:fun_info/2 will no longer accept pid as the second argument.

As of OTP 29, the maybe_expr feature will become permanent and no longer possible to disable. All uses of maybe as an atom will need to be quoted.

It is recommend to quote all uses of the atom maybe as soon as possible. The compiler option warn_keywords can be used to emit warnings about all occurrences of maybe without quotes.