summaryrefslogtreecommitdiff
path: root/system/doc/reference_manual
diff options
context:
space:
mode:
authorIlya Klyuchnikov <ilya.klyuchnikov@gmail.com>2023-03-06 23:10:06 +0000
committerIlya Klyuchnikov <ilya.klyuchnikov@gmail.com>2023-03-15 17:33:28 +0000
commit048e62b9041d84958f1e089b4ae3d4666004269e (patch)
tree2557432fb79a1ca45c3d74eb04a16a34265149cd /system/doc/reference_manual
parentfdfe130c4249678524adf4c28fd51311eca52c2d (diff)
downloaderlang-048e62b9041d84958f1e089b4ae3d4666004269e.tar.gz
EEP 61: Built-in dynamic type
Diffstat (limited to 'system/doc/reference_manual')
-rw-r--r--system/doc/reference_manual/typespec.xml17
1 files changed, 16 insertions, 1 deletions
diff --git a/system/doc/reference_manual/typespec.xml b/system/doc/reference_manual/typespec.xml
index e4b9c4f62c..fa751834f6 100644
--- a/system/doc/reference_manual/typespec.xml
+++ b/system/doc/reference_manual/typespec.xml
@@ -83,17 +83,32 @@
</p>
<pre> atom() | integer()</pre>
<p>
- Because of subtype relations that exist between types, types
+ Because of subtype relations that exist between types, all types,
+ except <c>dynamic()</c>,
form a lattice where the top-most element, <c>any()</c>, denotes
the set of all Erlang terms and the bottom-most element, <c>none()</c>,
denotes the empty set of terms.
</p>
<p>
+ To facilitate <url href="https://en.wikipedia.org/wiki/Gradual_typing">
+ gradual typing</url> of Erlang, the type `dynamic()` is provided.
+ It is similar to
+ <url href="https://docs.python.org/3/library/typing.html#the-any-type">Any</url>
+ in Python,
+ <url href="https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any">any</url>
+ in TypeScript and
+ <url href="https://docs.hhvm.com/hack/built-in-types/dynamic">dynamic</url>
+ in Hack. `any()` and `dynamic()` interact with
+ <url href="https://learnyousomeerlang.com/dialyzer#success-typing">success typing</url>
+ the same way, so Dialyzer doesn't distinguish between them.
+ </p>
+ <p>
The set of predefined types and the syntax for types follows:
</p>
<pre><![CDATA[
Type :: any() %% The top type, the set of all Erlang terms
| none() %% The bottom type, contains no terms
+ | dynamic()
| pid()
| port()
| reference()