[erlang-questions] What I dislike about Erlang

Thomas Lindgren thomasl_erlang@REDACTED
Fri Aug 31 10:47:53 CEST 2012





----- Original Message -----
> From: Max Lapshin <max.lapshin@REDACTED>

>
> Lack of frames makes almost impossible hot code upgrades with changing
> of data structures. It makes impossible distributing plugins.


The whole "upgrade your record/state" thing is pretty awkward (because at this point you usually have two definitions of the same record, for those who haven't thought about it). One approach is to write a shim module and do a more elaborate upgrade, which is a pain. Another approach is to grunt that "records are just syntactic sugar for tuples" and hack away. But I think this problem could also be fixed by changing the gen_* interface. Add two callbacks, invoked at the appropriate points:

* convert internal state to key-value list (when exiting the old version)
* convert key-value list to internal state (when entering the new version)

No more clashing record definitions. It would also be nice if the preprocessor could generate the from/to conversions. 

Usual disclaimers apply.

Best,
Thomas



More information about the erlang-questions mailing list