[erlang-questions] -define

Robert Virding rvirding@REDACTED
Thu Feb 18 11:49:38 CET 2010


There is a simple reason for this: sheer laziness by the original
writer of the epp module, me. Now I suppose it is difficult to change
because of backwards compatibility. The problem is compounded byt the
feature that macro expansions don't have to be complete erlang
expressions so sometimes you can't tell the macro definition is over
until you hit the '.' .

Robert

On 18 February 2010 06:32, Richard O'Keefe <ok@REDACTED> wrote:
> I've been trying out a weak pretty-printer for Erlang.
> (By "weak" I mean that it takes care of indentation but
> does not do anything about line breaking.)  It's supposed
> to be something I can build into my text editor.
>
> When I tried feeding other people's Erlang code into it,
> I ran into some problems.
>
> I was aware that when you write
>
>        -define(LHS, RHS).
>
> the stuff in RHS did not have to be bracket balanced, so
> that
>        -define(LP, ().
>        -define(RP, )).
>
> are OK.
> What I was *not* aware of was that there doesn't even have
> to be a closing right parenthesis at all.
>
> -module(ick).
> -export([ick/0]).
> -define(ICK, {1}.
>
> ick() -> ?ICK.
>
> The Erlang compiler is perfectly happy with this.
> There are several occurrences of this in the Erlang/OTP sources,
> but there doesn't seem to be any reason why.
>
>
>
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED
>
>


More information about the erlang-questions mailing list