[erlang-questions] [ANN] Erlang/OTP 17.0-rc1 has been released.

Fred Hebert mononcqc@REDACTED
Sat Feb 1 21:38:44 CET 2014


I'm aware of that, yes.

I tend to do it in one of a few ways:

1. Always add new fields to the end of the record to ensure not
   conflating fields in existence. Use element(#record.field, Record)
   to access existing fields of the old one, and
   list_to_tuple/tuple_to_list to add the new elements at the end.
2. Do it explicitly by opening everything up. It's easy to do with
   something as crappy as a copy/paste, then modifying the entries.
   It sucks, but it's explicit, not risky, and doesn't break DRY
   principles. It's the one you mentioned.
3. Be lucky and make it possible to just restart the process in the
   first place.

Ultimately, I prefer something that crashes loudly on failed updates
than not. I tend to change the internal state of production code rarely
enough to prefer the benefits of records most of the time with the
update weirdness happening once in a long while.

Different developers are of course allowed to feel differently about the
issue!

Regards,
Fred.

On 02/02, Max Lapshin wrote:
> Fred, your ideas are right, of course, but you forget that right now
> records doesn't have any infrastructure for code upgrade.
> 
> The only way is to make {state,  Field1, Field2, ....} mapping by hands.



More information about the erlang-questions mailing list