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

mats cronqvist masse@REDACTED
Mon Jan 5 17:38:04 CET 2009

"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

  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.


More information about the erlang-questions mailing list