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

Henning Thielemann schlepptop at henning-thielemann.de
Wed Jan 13 16:42:18 EST 2010

Maciej Piechotka schrieb:
> 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
Many of these problems are solved by preprocessor intervention in C/C++, 
but there is often no need to do so. You could also write system 
dependent modules, where the right module for your system is included by 
the build system. I hope the build system does not count as a 
preprocessor. In Haskell it is however still no fun to support multiple 
versions of the base libraries, not to speak of different compilers - 
and their set of libraries.

Unfortunately, the original question is still not answered.

More information about the Haskell-Cafe mailing list