[erlang-questions] run-time record limitations

Peter Lund erlang@REDACTED
Fri Jan 16 13:35:45 CET 2009


Define your mnesia record once:

-record(myrecord, {mnesia_prim_key, dict}).

Where the dict contains a dict. And then in runtime you may add how
many dictionary keys you'd like into the dictionary.

/Peter

deepblue skrev:
> Im developing an Erlang system and having reoccurring problems with
> the fact that record's are compile time pre-processor macros (almost),
> and that they cant be manipulated at runtime... basically Im working
> with a property pattern, where properties are added at run-time to
> objects on the front-end (AS3). Ideally I would reflect this with a
> list on the Erlang side, since its a fundamental datatype, but then
> using records in QLC [to query ETS tables] would not be possible since
> to use them I have to specifically say which record property I want to
> query over... I have at least 15 columns in the larges table, so
> listing them all in one huge switch statement (case X of) is just
> plain ugly.
>
> does anyone have any ideas how to elegantly solve this? maybe some
> built-in functions for creating tuples with appropriate signatures for
> use in pattern matching (for QLC)?
>
> thanks
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions
>




More information about the erlang-questions mailing list