Module attributes

Roger Price <>
Fri Sep 16 16:47:45 CEST 2005

I'm trying to understand the possibilities offered by module
attributes.  My source file "test.erl" contains just the two lines:

-module (test) .
-bad_binary(<<10,20>>) .

I'm using Erlang (BEAM) emulator version 5.4.6 [source] [hipe], and
the compiler crashes as follows:

:~> erlc test.erl
test.erl:none: internal error in core_module;
crash reason:

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)

Clause 2.1 Terms, says "Erlang provides a number of data types which
are listed in this chapter.  A piece of data of any data type is
called a term."

Clause 2.4 Binary, says that <<10,20>> is a binary and therefore a term.

Clause 2.6 Fun says a fun is a functional object.  I conclude that a fun
is a term, but if I write

   -add_one (fun (X) -> X+1 end) .

I get the error message "test.erl:5: bad attribute".

Shouldn't clause 4.2 say that a Module Attribute is -Tag(BasicTerm)
where BasicTerm is an integer, real number, atom or string?


More information about the erlang-questions mailing list