erl_eval_records

Erlang library for using records in erl_eval. Without extra manipulation you can not use records in interpret by erl_eval code. To solve this problems in erlang shell some magic is done.

This magic consist of:

Interface of this simple helper module contains functions represented 2 phases:

-record(test, {a}).

test() ->
  {ok, Tokens  , _} = erl_scan:string("#foo{a=A} = {foo, 0}, A."),
  {ok, Exprs      } = erl_parse:parse_exprs(Tokens),
  NewExprs          = erl_eval_records:expand(erl_eval_records:load(?MODULE), Exprs),
  {value, Value, _} = erl_eval:exprs(NewExprs, []),
  ?assertEqual(Value, 0).