Module attributes

Roger Price rprice@REDACTED
Tue Sep 20 18:41:38 CEST 2005


On 19 Sep 2005, Bjorn Gustavsson wrote:

> > In the Erlang Reference Manual 5.4.6: Clause 4.2 Module Attributes,
> > says that a module attribute consists of a tag and a value. -Tag(Term)
> I have changed it to say that the values for Module Attributes are
> "literal terms".

Clause 4.2.3 Macro and Record Definition, says that: "The same syntax as
for module definitions is used for macro and record definitions":
-record(Record,Fields)

where Record is an atom and Fields is a tuple.  However the following test
program

- module (test) .
- record (r,{}) .
- not_a_record (r,{}) .

produces the error message
rprice@REDACTED:~> erlc ./test/test.erl
test/test.erl:3: bad attribute

The -record(.,.) syntax has arity 2 whereas all user-defined attributes
have arity one, so may I suggest changing the wording of clause 4.2 from

"There exists a number of module attributes with predefined meanings."

to

"All user-defined module attributes have arity one.  There exists a number
of module attributes with predefined meanings, some of which have arity
two."

Roger




More information about the erlang-questions mailing list