simplified attribute declaration
Laszlo Lovei
lovei.laszlo@REDACTED
Thu Mar 18 20:33:20 CET 2010
On Mar 18, 10:59 am, Vlad Dumitrescu <vladd...@REDACTED> wrote:
> On Thu, Mar 18, 2010 at 10:33, Bengt Kleberg <bengt.kleb...@REDACTED> wrote:
> > Are you sure about -define without parentheses?
>
> The problem there is that the definition needs not be an Erlang term,
> so in that case the parantheses are necessary (or one can't have a dot
> inside it).
No, the open parenthesis after -define is not used for any purpose
(apart from checking its presence), it would be trivial to make it
optional. The preprocessor only checks that parentheses are balanced
inside the macro body, and the closing ')' of -define can even be left
out (probably because of historic reasons).
About dots: you can have simple '.' tokens (without subsequent
whitespace) regardless of parentheses, and you cannot have a stop
token (a dot followed by whitespace or end of file) in a macro
whatever you do, because it delimits forms and is handled before
preprocessing.
> In any case, since the current parser has this new functionality, it
> would be useful to have it documented and either recommended or not
> recommended to use except for -spec.
I completely agree. As this feature is not mentioned in the docs, I
have the impression that it is an incidental side effect of the
syntactic support for -type and -spec, and it would be nice to have
this clarified.
Laszlo
More information about the erlang-questions
mailing list