Coping with records?

Bengt Kleberg bengt.kleberg@REDACTED
Tue Nov 1 13:08:19 CET 2005


On 2005-11-01 12:38, Tim Bates wrote:
...deleted
> The only idea I have is to do all my operations on record-like data 
> structures through a function call interface, and embed a version number 
> in the record so that the functions know exactly which data structure 
> they are using. This seems a bit unwieldy though. Any ideas?

i use the unwieldy system of a module with create functions and access 
functions. it knows about the record, the rest of the system has to call it.

-module( kalle ).

-export([a/1,b/1,create/2]).

-record( kalle1, {a, b} ).

a( #kalle1{a=A} ) -> A.

b( #kalle1{b=B} ) -> B.

create( A, B ) -> #kalle1{a=A, b=B}.



More information about the erlang-questions mailing list