[erlang-questions] simplified attribute declaration

Robert Virding <>
Sat Mar 20 05:21:26 CET 2010

I think that it is unfortunate that there are two ways of writing
attributes, there should only be one. I definitely support fixing this
bug and only allow the parenthesized version. It is also unfortunate
that there is an inconsistency between the ways of writing attributes
and -spec and -type, it would be better if both were done in the same
way, preferably with parentheses. Adding new constructs to the
language is sometimes necessary, but adding them in an inconsistent
way is definitely not good. You get too many special cases.

If it is decided to remove the parentheses from attributes then I
definitely think we should go all the way remove the surrounding
parentheses from function definition heads as well. By forcing the
user to sometimes (rarely) wrap arguments with parentheses it would
also be possible to remove the commas between the arguments as well.
Then we could probably do the same for function calls in bodies as
well, though I haven't really thought it through properly that far
yet. If we start going down that path then we might as well do it

-module foo.
-export member/1.

member X [X|_] -> true;
member X [_|T] -> member X T;
member X [] -> false.


On 19 March 2010 15:53, Kenneth Lundin <> wrote:
> For -spec and -type you don't need the surrounding parentheses right
> now and we don't
> regard it as a bug.
> It is possible that we will do something about the so called
> inconsistency sooner or later.
> /Kenneth Erlang/OTP, Ericsson
> On Fri, Mar 19, 2010 at 3:08 PM, Vlad Dumitrescu <> wrote:
>> 2010/3/19 Kenneth Lundin <>:
>>> We have no plans at all to support attributes without parentheses no matter if
>>> the attribute has one or several parameters. That this syntax is
>>> accepted now is a
>>> bug which will be corrected.
>>> We will also make it mandatory to have a closing parenthesis in defines.
>> This includes -spec and -type, or is the inconsistency going to remain?
>> best regards,
>> Vlad
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:

More information about the erlang-questions mailing list