summaryrefslogtreecommitdiff
path: root/system/doc
diff options
context:
space:
mode:
authorCons T Åhs <cons@erlang.org>2022-05-30 15:31:45 +0200
committerCons T Åhs <cons@erlang.org>2022-06-23 14:49:37 +0200
commit66ad90120dfee4a64fb264c7bbb76636ee0ff6fd (patch)
treed759b3383967b6eb65e4cd89cc5903caa51b2d61 /system/doc
parenta282bcbe80b8f1768233c2ef5d0ba536f0c6ced5 (diff)
downloaderlang-66ad90120dfee4a64fb264c7bbb76636ee0ff6fd.tar.gz
[features] General tweaks and fixes
* Add erl_features:configurable/0 * Return configurable features, since these are the most interesting * Use erl_features:configurable/0 where approriate * Change meaning of meta feature 'all' to configurable features * Prevent using non configurable features * Change so that we can only enable/disable configurable features * Permanent features will be seen as both avilable and enabled by the macros FEATURE_AVAILABLE and FEATURE_ENABLED, but they will not be recorded in the BEAM file, nor will they be enabled in the runtime system. * Force load erl_features module * Documentation * General improvements * Remove mention of -compile attribute for features, since it (no longer) works and should not, as it just makes epp even more complicated than it is today * Error handling * Improve error message for misplaced directive * Rewrite error handling to be more precise by distinguishing between invalid and non configurable features * Catch all unknown or non configurable features * Keep order of +options to erlc * Bugs * Fix bug to avoid multiple instances in chunk * Fix ordering bug for +options to erlc * Tests * Remove lux scripts * Move tests to common test
Diffstat (limited to 'system/doc')
-rw-r--r--system/doc/reference_manual/expressions.xml2
-rw-r--r--system/doc/reference_manual/features.xml11
-rw-r--r--system/doc/reference_manual/macros.xml21
-rw-r--r--system/doc/reference_manual/modules.xml24
4 files changed, 51 insertions, 7 deletions
diff --git a/system/doc/reference_manual/expressions.xml b/system/doc/reference_manual/expressions.xml
index 3a01066410..b5b920cc79 100644
--- a/system/doc/reference_manual/expressions.xml
+++ b/system/doc/reference_manual/expressions.xml
@@ -1815,7 +1815,7 @@ end</pre>
<item>Expressions that construct atoms, integer, floats, lists,
tuples, records, binaries, and maps</item>
<item>Expressions that update a map</item>
- <item>The record epxressions <c>Expr#Name.Field</c> and <c>#Name.Field</c></item>
+ <item>The record expressions <c>Expr#Name.Field</c> and <c>#Name.Field</c></item>
<item>Calls to the BIFs specified in tables <em>Type Test BIFs</em> and
<em>Other BIFs Allowed in Guard Expressions</em></item>
<item>Term comparisons</item>
diff --git a/system/doc/reference_manual/features.xml b/system/doc/reference_manual/features.xml
index ed254db55a..882cdd2582 100644
--- a/system/doc/reference_manual/features.xml
+++ b/system/doc/reference_manual/features.xml
@@ -142,13 +142,12 @@
<item>The compiler option <seeerl
marker="compiler:compile#feature-option"><c>{feature,
&lt;feature&gt;, enable|disable}</c></seeerl> can be used either
- as a <c>+&lt;term&gt;</c> option to <c>erlc</c>, in the options
- argument to function in the <c>compile</c> module, or in the
- <c>-compile(..)</c> attribute in a file.</item>
+ as a <c>+&lt;term&gt;</c> option to <c>erlc</c> or in the options
+ argument to functions in the <c>compile</c> module.</item>
<tag>The feature directive</tag>
- <item>Inside a prefix of a module, one can use a <seeerl
- marker="compiler:compile#feature-directive"><c>-feature(&lt;feature&gt;,
- enable|disable)</c></seeerl> directive. This is the preferred
+ <item>Inside a prefix of a module, one can use a <seeguide
+ marker="macros#feature-directive"><c>-feature(&lt;feature&gt;,
+ enable|disable)</c></seeguide> directive. This is the preferred
method of enabling and disabling features.</item>
</taglist>
<p>
diff --git a/system/doc/reference_manual/macros.xml b/system/doc/reference_manual/macros.xml
index ffa5373613..e54e0e1d30 100644
--- a/system/doc/reference_manual/macros.xml
+++ b/system/doc/reference_manual/macros.xml
@@ -277,6 +277,27 @@ or
</section>
<section>
+ <title>
+ The -feature() directive
+ </title>
+ <marker id="feature-directive"/>
+
+ <p>
+ The directive <c>-feature(FeatureName, enable | disable)</c> can
+ be used to enable or disable the <seeguide
+ marker="system/reference_manual:features#features">feature</seeguide>
+ <c>FeatureName</c>. This is the preferred way of enabling
+ (disabling) features, although it is possible to do it with
+ options to the compiler as well.
+ </p>
+ <p>
+ Note that the <c>-feature(..)</c> directive may only appear
+ before any syntax is used. In practice this means it should
+ appear before any <c>-export(..)</c> or record definitions.
+ </p>
+ </section>
+
+ <section>
<title>-error() and -warning() directives</title>
<p>The directive <c>-error(Term)</c> causes a compilation error.</p>
diff --git a/system/doc/reference_manual/modules.xml b/system/doc/reference_manual/modules.xml
index 4de72d1b7f..b373e2506b 100644
--- a/system/doc/reference_manual/modules.xml
+++ b/system/doc/reference_manual/modules.xml
@@ -251,6 +251,30 @@ behaviour_info(callbacks) -> Callbacks.</pre>
</section>
<section>
+ <title>
+ The feature directive
+ </title>
+
+ <p>
+ While not a module attribute, but rather a directive (since it
+ might affect syntax), there is the <c>-feature(..)</c>
+ directive used for enabling and disabling <seeguide
+ marker="system/reference_manual:features#features">features</seeguide>.
+ </p>
+ <p>
+ The syntax is similar to that of an attribute, but has two
+ arguments:
+ </p>
+ <pre>
+-feature(FeatureName, enable | disable).</pre>
+ <p>
+ Note that the <seeguide
+ marker="macros#feature-directive">feature directive</seeguide>
+ can only appear in a prefix of the module.
+ </p>
+ </section>
+
+ <section>
<title>Comments</title>
<p>Comments can be placed anywhere in a module except within strings
and quoted atoms. A comment begins with the character "%",