[erlang-questions] simplified attribute declaration

Håkan Mattsson hakan@REDACTED
Fri Mar 19 14:36:06 CET 2010


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