From ec72f8938ed5217d85c3b4cbb5080ae209bd8ae3 Mon Sep 17 00:00:00 2001
From: Hans Bolinder
Date: Wed, 4 Sep 2013 16:29:16 +0200
Subject: Correct documentation of predefined and built-in types
iodata/0, arity/0, and nonempty_list/0,1 have been added;
nonempty_maybe_improper_list/1 and maybe_improper_list/1 removed.
---
system/doc/reference_manual/typespec.xml | 28 ++++++++++++++++------------
1 file changed, 16 insertions(+), 12 deletions(-)
diff --git a/system/doc/reference_manual/typespec.xml b/system/doc/reference_manual/typespec.xml
index 1279493ba8..97ab344f7d 100644
--- a/system/doc/reference_manual/typespec.xml
+++ b/system/doc/reference_manual/typespec.xml
@@ -124,6 +124,7 @@
List :: list(Type) %% Proper list ([]-terminated)
| improper_list(Type1, Type2) %% Type1=contents, Type2=termination
| maybe_improper_list(Type1, Type2) %% Type1 and Type2 as above
+ | nonempty_list(Type) %% Proper non-empty list
Tuple :: tuple() %% stands for a tuple of any size
| {}
@@ -146,9 +147,8 @@
Because lists are commonly used, they have shorthand type notations.
- The type list(T) has the shorthand [T].
- The shorthand [T,...] stands for
- the set of non-empty proper lists whose elements are of type T.
+ The types list(T) and nonempty_list(T) have the shorthands
+ [T] and [T,...], respectively.
The only difference between the two shorthands is that [T] may be an
empty list but [T,...] may not.
@@ -194,7 +194,7 @@
maybe_improper_list() | maybe_improper_list(any(), any()) |
- maybe_improper_list(T) | maybe_improper_list(T, any()) |
+ nonempty_list() | nonempty_list(any()) |
string() | [char()] |
@@ -203,13 +203,19 @@
nonempty_string() | [char(),...] |
+ iodata() | iolist() | binary() |
+
+
iolist() | maybe_improper_list(byte() | binary() | iolist(), binary() | []) |
module() | atom() |
- mfa() | {atom(),atom(),byte()} |
+ mfa() | {atom(),atom(),arity()} |
+
+
+ arity() | 0..255 |
node() | atom() |
@@ -253,15 +259,13 @@
but they are expected to be rarely used. Hence, they have long names:
- nonempty_maybe_improper_list(Type) :: nonempty_maybe_improper_list(Type, any())
- nonempty_maybe_improper_list() :: nonempty_maybe_improper_list(any())
-
- where the following two types
- define the set of Erlang terms one would expect:
-
-
+ nonempty_maybe_improper_list() :: nonempty_maybe_improper_list(any(), any())
nonempty_improper_list(Type1, Type2)
nonempty_maybe_improper_list(Type1, Type2)
+
+ where the last two types
+ define the set of Erlang terms one would expect.
+
Also for convenience, we allow for record notation to be used.
Records are just shorthands for the corresponding tuples.
--
cgit v1.2.3