[erlang-questions] Getting rid of the preprocessor

Vlad Dumitrescu vladdu55@REDACTED
Thu May 24 10:52:46 CEST 2012


There have been discussions now and then about the preprocessor and
how it would be better to get rid of it. As someone that has to parse
and handle source files before they are preprocessed, I am very much
affected by it -- with macros that can be anything, an raw Erlang file
can look like pretty much anything. Even if the macros are in practice
mostly well-behaved, using them as alternatives to inlining code
creates problem when debugging, for example, because you can't step
through a macro invocation.

One of the main reasons that was presented for not being able to
replace the preprocessor with something that works at the lexical
level is that records would need to be first made first-class citizens
(as frames or whatever). I don't understand why that is -- the
preprocessor doesn't do anything with records, their expansion is done
later, by the compiler. Could someone comment on that, please?

Is this issue a "definitely no-no" for OTP, or would it be considered
if we can come up with a solution that doesn't break anything?

Stepping through the code in the debugger is being thwarted even by
the use of parse transforms. This could be handled by letting the
debugger reconstruct the source it shows from the parsed
representation and not from the source file.

best regards,

More information about the erlang-questions mailing list