[erlang-questions] simplified attribute declaration

Kostis Sagonas <>
Fri Mar 19 14:59:46 CET 2010

Håkan Mattsson wrote:
> On Fri, Mar 19, 2010 at 1:23 PM, Kostis Sagonas <> wrote:
>> What is really happening is that attributes which take just one argument do
>> not need to be enclosed in parentheses. On the other hand, attributes with
>> more than one argument (read: whenever there is a ',' involved, as in the
>> case of -define above) need to be enclosed in parentheses. This was
>> introduced in order to allow types and specs to be written without
>> parentheses but the mechanism is more general and applies to all 1-arity
>> attributes. This is fine, I think, and does not need to be changed.
> I think that this "mechanism" is unfortunate as it introduces an asymmetry
> between the source code and its internal form in the compiler. Either you
> should keep information about the optional parenthesis in the internal form
> or you should stick with mandatory parenthesis. Otherwise you cannot recreate
> the source code.

How is that different from what's happening today in other Erlang source 
code?  E.g. in code that for whatever reason the user has decided to 
write as follows:


foo1() -> 42.

foo2() -> (42).

foo3() -> (((42))).

foo4() -> (m):(bar)((42)).

Does the compiler maintain enough information on how many parentheses 
the user has written in each of these cases?


More information about the erlang-questions mailing list