[erlang-questions] Reading records with file:consult/1 or erl_eval/2?

Christian <>
Fri Nov 21 15:41:31 CET 2008


On Fri, Nov 21, 2008 at 15:29, Rusty Klophaus <> wrote:
> I've hit an unanticipated snag on step one. I can read basic terms
> just fine, but I can't make file:consult/1 or erl_eval:expr/2
> recognize records. Any suggestions? Is this just a known limitation?

It will not work, since records are macros and there is no information
of how to create a record of a given name at runtime. You will have to
specify the values of a document by tuple index, and have some kind of
massage of the data as records and into your record fields. Think

massage({document, X, Y, Z}) ->
   #document(x=X,y=Y,z=Z);



More information about the erlang-questions mailing list