[erlang-questions] Are nested records copied?

Bryan Hughes bryan@REDACTED
Sat Jun 1 17:34:36 CEST 2013


Howdy!

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.

If I define a person and manager record:

1> rd(person, {name, age}).
person
2> rd(manager, {person, dept}).
manager

Then create a person record:

3> P = #person{name = bryan, age = 45}.
#person{name = bryan,age = 45}

And then a manager record:

4> M = #manager{person = P, dept = foo}.
#manager{person = #person{name = bryan,age = 45},dept = foo}

When the manager record is created, is the nested person record P 
referenced by the manager record M, or is it copied?

Thanks,
Bryan

-- 

Bryan Hughes
*Go Factory*
http://www.go-factory.net

/"Internet Class, Enterprise Grade"/


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20130601/32f0a4e3/attachment.htm>


More information about the erlang-questions mailing list