It's not copied in this case, nested records aren't flattened or anything like that. Records are just tuples after all. <span></span><br><br>On Saturday, June 1, 2013, Bryan Hughes wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
Howdy!<br>
<br>
I am working on section of code that will be dealing with a large
number of records in a relatively tight loop and have a question in
how Erlang constructs a nested record.<br>
<br>
If I define a person and manager record:<br>
<br>
1> rd(person, {name, age}).<br>
person<br>
2> rd(manager, {person, dept}).<br>
manager<br>
<br>
Then create a person record:<br>
<br>
3> P = #person{name = bryan, age = 45}.<br>
#person{name = bryan,age = 45}<br>
<br>
And then a manager record:<br>
<br>
4> M = #manager{person = P, dept = foo}.<br>
#manager{person = #person{name = bryan,age = 45},dept = foo}<br>
<br>
When the manager record is created, is the nested person record P
referenced by the manager record M, or is it copied? <br>
<br>
Thanks,<br>
Bryan<br>
<br>
<div>-- <br>
<p style="font-size:12px">
Bryan Hughes<br>
<b>Go Factory</b><br>
<a href="http://www.go-factory.net" target="_blank">http://www.go-factory.net</a><br>
<br>
<i>"Internet Class, Enterprise Grade"</i><br>
</p>
<p><br>
</p>
</div>
</div>
</blockquote>