aboutsummaryrefslogtreecommitdiffstats
path: root/system/doc
diff options
context:
space:
mode:
authorHans Bolinder <[email protected]>2016-10-07 08:22:12 +0200
committerHans Bolinder <[email protected]>2016-10-07 08:22:12 +0200
commite9bb2e8797931efefac711d1b6d0de9571024c4d (patch)
tree7b35172fc4903b202a49e95b1ba1a61a884317cb /system/doc
parentf0d7db28c079a47425aa118e960cb2b914a85b29 (diff)
parent1c18d72600eb2156c6dee75026d8cb904249fbaa (diff)
downloadotp-e9bb2e8797931efefac711d1b6d0de9571024c4d.tar.gz
otp-e9bb2e8797931efefac711d1b6d0de9571024c4d.tar.bz2
otp-e9bb2e8797931efefac711d1b6d0de9571024c4d.zip
Merge branch 'maint'
* maint: Update per review comments. Fix reference to automatic `undefined` field declared types.
Diffstat (limited to 'system/doc')
-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: