[erlang-questions] managing large records
Szabolcs Berecz
szabolcs.berecz@REDACTED
Sun May 11 13:05:14 CEST 2008
Hi,
I have a record with a lot of fields which are updated nontrivially. I
tried to create a process for this task which looks like this:
-record(mm, {a=1,b=4,c}).
new() ->
loop(#mm{}).
loop(Mm) ->
receive
{set, Field, Value} ->
loop(Mm#mm{Field=Value});
{get, Pid} ->
Pid ! Mm,
loop(Mm)
end.
But as you probably know, it doesn't work because it needs to now the
value of Field at compile time (or at least, that's what I have
concluded).
So, my question is: how would you solve the problem (lot's of fields,
almost random updates)?
Szabi
--
DRM: Digital Restrictions Management -- learn about the dangers at
http://www.defectivebydesign.org/what_is_drm
More information about the erlang-questions
mailing list