BEAM implementation questions
Vladimir Sekissov
svg@REDACTED
Wed Jan 26 12:24:18 CET 2005
Good day,
thomasl_erlang> > > I'd like support for this, perhaps even moreso if
thomasl_erlang> > > there was some language support for declaring
thomasl_erlang> > > "constant data".
But you can use parameterized modules to emulate this.
-module(t, [Data]).
-export([gv/1]).
gv(Idx) ->
proplists:get_value(Idx, Data).
1> T=t:new([{a, b}, {c, d}]).
{t,[{a,b},{c,d}]}
2> T:gv(a).
b
3> file:write_file("T.dump", term_to_binary(T)).
ok
....
1> l(t).
{module,t}
2> {ok, B} = file:read_file("T.dump").
{ok,<<131,104...
3> T=binary_to_term(B).
{t,[{a,b},{c,d}]}
4> T:gv(a).
b
Best Regards,
Vladimir Sekissov
More information about the erlang-questions
mailing list