From 45c380d1b77198449fb8e3beadb39dc8f77abb72 Mon Sep 17 00:00:00 2001 From: Tuncer Ayaz Date: Tue, 20 Apr 2010 20:44:45 +0200 Subject: Document R14 paren-less record access/update Add a section to the reference manual describing the R14 change to not require parentheses when accessing or updating fields in nested records. Signed-off-by: Tuncer Ayaz --- system/doc/reference_manual/records.xml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'system') diff --git a/system/doc/reference_manual/records.xml b/system/doc/reference_manual/records.xml index e2fe5fe8de..e901b7bccf 100644 --- a/system/doc/reference_manual/records.xml +++ b/system/doc/reference_manual/records.xml @@ -144,6 +144,29 @@ is_person(_P) -> unbound variables.

+
+ Nested records +

Beginning with R14 parentheses when accessing or updating nested + records can be omitted. Assuming we have the following record + definitions:

+
+-record(nrec0, {name = "nested0"}).
+-record(nrec1, {name = "nested1", nrec0=#nrec0{}}).
+-record(nrec2, {name = "nested2", nrec1=#nrec1{}}).
+
+N2 = #nrec2{},
+    
+

Before R14 you would have needed to use parentheses as following:

+
+"nested0" = ((N2#nrec2.nrec1)#nrec1.nrec0)#nrec0.name,
+N0n = ((N2#nrec2.nrec1)#nrec1.nrec0)#nrec0{name = "nested0a"},
+    
+

Since R14 you can also write:

+
+"nested0" = N2#nrec2.nrec1#nrec1.nrec0#nrec0.name,
+N0n = N2#nrec2.nrec1#nrec1.nrec0#nrec0{name = "nested0a"},
+
+
Internal Representation of Records

Record expressions are translated to tuple expressions during -- cgit v1.2.3