aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Bolinder <[email protected]>2016-10-07 08:19:46 +0200
committerHans Bolinder <[email protected]>2016-10-07 08:19:46 +0200
commit1c18d72600eb2156c6dee75026d8cb904249fbaa (patch)
treea4ea1cee8c73d94f3f06bf9ce86e485ea858467d
parent5acfcf3758f89ba32d44807cd8cb406a55d39836 (diff)
parent0411bfded2ee9aefb8178a47d139b54913490d5b (diff)
downloadotp-1c18d72600eb2156c6dee75026d8cb904249fbaa.tar.gz
otp-1c18d72600eb2156c6dee75026d8cb904249fbaa.tar.bz2
otp-1c18d72600eb2156c6dee75026d8cb904249fbaa.zip
Merge branch 'rohrer/doc/undefined_fields/PR-1189' into maint
* rohrer/doc/undefined_fields/PR-1189: Update per review comments. Fix reference to automatic `undefined` field declared types.
-rw-r--r--system/doc/reference_manual/typespec.xml15
1 files changed, 9 insertions, 6 deletions
diff --git a/system/doc/reference_manual/typespec.xml b/system/doc/reference_manual/typespec.xml
index 1899efd5f3..ced584ed35 100644
--- a/system/doc/reference_manual/typespec.xml
+++ b/system/doc/reference_manual/typespec.xml
@@ -409,11 +409,13 @@
The initial values for fields are to be compatible
with (that is, a member of) the corresponding types.
This is checked by the compiler and results in a compilation error
- if a violation is detected. For fields without initial values,
- the singleton type <c>'undefined'</c> is added to all declared types.
- In other words, the following two record declarations have identical
- effects:
+ if a violation is detected.
</p>
+ <note>
+ <p>Before Erlang/OTP 19, for fields without initial values,
+ the singleton type <c>'undefined'</c> was added to all declared types.
+ In other words, the following two record declarations had identical
+ effects:</p>
<pre>
-record(rec, {f1 = 42 :: integer(),
f2 :: float(),
@@ -423,9 +425,10 @@
f2 :: 'undefined' | float(),
f3 :: 'undefined' | 'a' | 'b'}).</pre>
<p>
- For this reason, it is recommended that records contain initializers,
- whenever possible.
+ This is no longer the case. If you require <c>'undefined'</c> in your record field
+ type, you must explicitly add it to the typespec, as in the 2nd example.
</p>
+ </note>
<p>
Any record, containing type information or not, once defined,
can be used as a type using the following syntax: