[erlang-questions] trouble with erlang or erlang is a ghetto
Wed Jul 27 23:10:13 CEST 2011
Yes, records are awkward for sharing across interfaces for this reason.
When I wrote the Diameter application (which is now part of OTP), I tried to mitigate the problem in two ways:
- Allow the user to pass a proplist as an alternative to the record. This requires a conversion step, and some slight overhead.
- Use 'exprecs' (part of http://github.com/esl/parse_trans, although the Diameter app has its own version), to generate accessor functions similar to what you describe. The notation is perhaps not the most beautiful, but you get used to it.
Exprecs actually also has some upgrade support, where you can specify different versions of the same record:
I don't know if anyone has ever used it; I've never received comments on it, as far as I recall.
On 27 Jul 2011, at 22:36, Max Lapshin wrote:
> Ulf. There maybe many speculations about "most convenient language" or
> "best garbage collection", but one serious problem is really
> It is lack of data structure, which can survive upgrade of only one
> part of software.
> I can't create redistributable plugins for erlyvideo that can use
> headers with record description, I have to write such things:
> ems_media:get(Media, last_dts)
> and frankly speaking I don't understand how do other people live without this.
> I understand, that C language has the same problem, but maybe there
> are some ideas to make some delayed instantiation of record usage in
> I.e. add "record_get(Record, name)" instruction to beam, which should
> be translated to "element(Record, N)" on loading?
Ulf Wiger, CTO, Erlang Solutions, Ltd.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions