[erlang-questions] simplified attribute declaration

Robert Virding rvirding@REDACTED
Sat Mar 20 05:03:09 CET 2010


On 19 March 2010 14:59, Kostis Sagonas <kostis@REDACTED> wrote:
>
> 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:
>
> -module(foo).
> -compile(export_all).
>
> 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?

It implicitly maintains enough information about the effect of the
parentheses when it builds the abstract syntax tree. If the AST is
printed then enough parentheses are added to make an equivalent
representation.

If you really want to keep all information about parentheses then you
should use lisp, or LFE to get the best of both worlds.

Robert


More information about the erlang-questions mailing list