-define

Richard O'Keefe ok@REDACTED
Thu Feb 18 06:32:59 CET 2010


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.




More information about the erlang-questions mailing list