[erlang-questions] simplified attribute declaration

Kenneth Lundin kenneth.lundin@REDACTED
Fri Mar 19 14:52:03 CET 2010


Just a clarification.

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.

/Kenneth Erlang/OTP , Ericsson

2010/3/19 Håkan Mattsson <hakan@REDACTED>:
> On Fri, Mar 19, 2010 at 1:23 PM, Kostis Sagonas <kostis@REDACTED> 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. I do not see the point in having yet another syntax
> alternative.
> It is about as useful as the misfeature with optional closing
> parenthesis in defines.
>
> /Håkan
>


More information about the erlang-questions mailing list