[erlang-questions] Newbie: Compile error with records

Schneider schneider@REDACTED
Tue Apr 29 17:24:30 CEST 2014


Works now using a function. Thanks.

 

Van: Alex Hammel [mailto:ahammel87@REDACTED] 
Verzonden: dinsdag 29 april 2014 17:21
Aan: Schneider
CC: erlang-questions@REDACTED
Onderwerp: Re: [erlang-questions] Newbie: Compile error with records

 

I don't think it's legal to construct record instances at the top level. (Even if it was, how would you refer to them?)

You'll need to wrap the record construction in a function or a macro.

 

On Tue, Apr 29, 2014 at 7:48 AM, Schneider <schneider@REDACTED> wrote:

Hi list,

 

I am trying to create a bunch of records in an include file, but I just can’t get it to work.

What is wrong about this hrl file

 

-record(data_ids, {data_id, mnem, descr}).

 

#data_ids{data_id=1, mnem="ONE", descr="Number one."}.

 

The compiler gives the error:

src/data_ids.hrl:5: syntax error before: '#'

 

Thanks


_______________________________________________
erlang-questions mailing list
erlang-questions@REDACTED
http://erlang.org/mailman/listinfo/erlang-questions

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20140429/302a98bc/attachment.htm>


More information about the erlang-questions mailing list