What you mean is like this?<div><br></div><div>code_change(_OldVer, Statename, Data = #state{}, _Extra) -></div><div> {ok, Statename, Data#state{ newfield = Something}.</div><div><br></div><div><br></div><div><br>
<div class="gmail_quote">On Tue, Nov 22, 2011 at 2:38 PM, Bengt Kleberg <span dir="ltr"><<a href="mailto:bengt.kleberg@ericsson.com">bengt.kleberg@ericsson.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Greetings,<br>
<br>
The way it is done in our code (lots of it) is to match the old record<br>
as a tuple.<br>
<span class="HOEnZb"><font color="#888888"><br>
<br>
bengt<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
On Mon, 2011-11-21 at 16:51 +0100, Daniel Dormont wrote:<br>
> Hello all,<br>
><br>
> I have a gen_fsm module and would like to take advantage of hot code<br>
> deploy. The module uses a record (called "state") and the new version<br>
> of the module includes some new fields in the record. What is a nice<br>
> clean way to code the my_module:code_change function to deal with<br>
> this? Are there any good examples out there on the web?<br>
><br>
> Note: for my purposes it would be sufficient to detect that the state<br>
> record is out of date, and terminate cleanly. BUT the correct<br>
> functionality of the terminate/3 function in my module depends on the<br>
> state data, and I would need it to complete cleanly and not crash in<br>
> this instance because there are other processes that depend on this<br>
> one and need to be notified properly of its exit. The issue is that<br>
> the state itself contains the data of which processes those are.<br>
><br>
> What's the best approach here?<br>
><br>
> thanks,<br>
> Dan<br>
> _______________________________________________<br>
> erlang-questions mailing list<br>
> <a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
> <a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
<br>
_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
</div></div></blockquote></div><br></div>