[erlang-questions] records in erlang and error while creating it

attila.rajmund.nohl@REDACTED attila.rajmund.nohl@REDACTED
Mon Mar 5 13:01:09 CET 2007


On Mon, 5 Mar 2007, Bengt Kleberg wrote:

> On 2007-03-05 11:49, hemant wrote:
>> this might be a really stupid question, but at shell I am doing this:
>>
>> 2> -record(person, {
>> 2> firstName = "",
>> 2> lastName = "",
>> 2> age}).
>>
>> =ERROR REPORT==== 5-Mar-2007::16:06:35 ===
>> Error in process <0.33.0> with exit value: {{badmatch,[]},[{erl_eval,expr,3}]}
>
> the record is a preprocessor thing. you can not create records in the shell.

There is that rd() function that can do something like this:
1> rd(person, {firstName = "",lastName = "",age}).
person
2> P=#person{}.
#person{firstName = [],lastName = [],age = undefined}

 				Bye,NAR
-- 
"Beware of bugs in the above code; I have only proved it correct, not
  tried it."



More information about the erlang-questions mailing list