10.7 Nested Records
Beginning with Erlang/OTP R14, parentheses when accessing or updating nested records can be omitted. Assume the following record definitions:
- -record(nrec0, {name = "nested0"}).
- -record(nrec1, {name = "nested1", nrec0=#nrec0{}}).
- -record(nrec2, {name = "nested2", nrec1=#nrec1{}}).
- N2 = #nrec2{},
Before R14, parentheses were needed as follows:
- "nested0" = ((N2#nrec2.nrec1)#nrec1.nrec0)#nrec0.name,
- N0n = ((N2#nrec2.nrec1)#nrec1.nrec0)#nrec0{name = "nested0a"},
Since R14, the following can also be written:
- "nested0" = N2#nrec2.nrec1#nrec1.nrec0#nrec0.name,
- N0n = N2#nrec2.nrec1#nrec1.nrec0#nrec0{name = "nested0a"},