[erlang-questions] Best practice to hot update .hrl

Kaiduan Xie kaiduanx@REDACTED
Mon Jan 5 20:43:10 CET 2009


Many thanks for all the excellent explanations. Mats, can you explain a bit
more on following?



"In this respect, proplists or dicts are much better if you can live with
the (modest) performance hit."

Thanks,

kaiduan


On 1/5/09, mats cronqvist <masse@REDACTED> wrote:
>
> "Kaiduan Xie" <kaiduanx@REDACTED> writes:
>
> > Hi,
> >
> > OTP Design principles talks a lot on how to do release handling. However
> it
> > does not discuss the case where .hrl file is updated. For example, how to
> deal
> > the the following cases?
> > 1. A new record is added,
> > 2. An element is removed/added from an existing record,
> > 3. A value of macro is changed.
>
> included files (the .hrl suffix is just a convention) are inserted
> in the .erl file by the compiler.  recompiling/reloading all .erl
> files that include your .hrl will cover the easy cases, i.e. when no
> process has the old version of the record/macro on the stack/in a
> register.
>
> this is why all long-lived processes should be gen_servers; you can
> use the code_change method to transform the state. but no matter how
> you do it, the combination records-upgrades will always suck. in
> this respect, proplists or dicts are much better if you can live
> with the (modest) preformance hit.
>
> mats
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20090105/c037cfaf/attachment.htm>


More information about the erlang-questions mailing list