In Erlang/OTP 25, in order to load a module with a feature enabled, it was necessary to also enable the feature in the runtime. This was done using option -enable-feature to erl. This requirement was removed in Erlang/OTP 26.
A feature will start out with a status of experimental part of OTP, making it possible to try out for users and give feedback. The possibility to try out features is enabled by options to the compiler, directives in a module and options to the runtime system. Even when a feature is not experimental it will still be possible to enable or disable it. This makes it possible to adapt a code base at a suitable pace instead of being forced when changing to a new release.
The status of a feature will eventually end up as being either a permanent part of OTP or rejected, being removed and no longer selectable.
A feature is in one of four possible states:
After leaving the experimental state, a feature can enter any of the other three states, and if the next state is approved, the feature will eventually end up in the permanent state. A feature can change state only in connection with a release.
A feature may be in the approved state for several releases.
| State | Default | Configurable | Available |
| Experimental | disabled | yes | yes |
| Approved | enabled | yes | yes |
| Permanent | enabled | no | yes |
| Rejected | disabled | no | no |
Table 13.1: Feature States
FEATURE_AVAILABLE macro.To use a feature that is in the experimental state, it has to be enabled during compilation. This can be done in a number of different ways:
erlc-enable-feature and -disable-feature can be used to enable or disable individal features.{feature, <feature>, enable|disable} can be used either as a +<term> option to erlc or in the options argument to functions in the compile module.-feature(<feature>, enable|disable) directive. This is the preferred method of enabling and disabling features.In Erlang/OTP 25, in order to load a module with a feature enabled, it was necessary to also enable the feature in the runtime. This was done using option -enable-feature to erl. This requirement was removed in Erlang/OTP 26.
To allow for conditional compilation during transitioning of a code base and/or trying out experimental features feature predefined macros ?FEATURE_AVAILABLE(Feature) and ?FEATURE_ENABLED(Feature) are available.
The module erl_features erl_features exports a number of functions that can be used to obtain information about current features as well as the features used when compiling a module.
One can also use the erlc options -list-features and -describe-feature <feature> to get information about existing features.
Additionally, there is the compiler option warn_keywords that can be used to find atoms in the code base that might collide with keywords in features not yet enabled.
The following configurable features exist:
© 2010–2023 Ericsson AB
Licensed under the Apache License, Version 2.0.