[Haskell-cafe] Re: looking for origin of quote on preprocessors and language design

Maciej Piechotka uzytkownik2 at gmail.com
Thu Jan 7 08:18:16 EST 2010

On Thu, 2010-01-07 at 13:32 +0100, Johannes Waldmann wrote:
> Dear all,
> It's not exactly Haskell-specific, but ...
> I am trying to track down the origin of the proverb
> "the existence (or: need for) a preprocessor
> shows omissions in (the design of) a language."
> I like to think that in Haskell, we don't need
> preprocessors since we can manipulate programs
> programmatically, because they are data.
> In other words, a preprocessor realizes higher order
> functions, and you only need this if your base language
> is first-order.
> Yes, that's vastly simplified, and it does not cover
> all cases, what about generic programming
> (but this can be done via Data.Data)
> and alex/happy (but we have parsec) etc etc.
> Best regards, J.W.

Not quite. While I agree that "the *frequent* need for a preprocessor
shows omissions in (the design of) a language." it is not necessary the
case. Preprocessor may be useful if:

- there is a new beatyful feature in newer version of compiler but you
still want to have backward compatibility.
- there are compiler or platform dependant elements. For example if you
write a driver in Haskell you may want to share code as much as possible
but you need to know 1) the size of registers and 2) the platform you're
writing as Windows have quite different API then Linux or BSD.
- You need to enable/disable features at build-time. It is not frequent
at closed-source system but it is frequent on OpenSource systems. For
example I might need to have minimal program for embedded system but
with full feature set it likly conquer the desktops

in such cases it is easier/more efficient to just write
#if (defined WINDOWS && BITS >= 64) || defined ALSA
#elseif GHC_VERSION >= 061004



More information about the Haskell-Cafe mailing list