[Haskell-cafe] Functions are first class values in C

Antti-Juhani Kaijanaho antti-juhani at kaijanaho.fi
Mon Dec 24 05:22:50 EST 2007

On Sat, Dec 22, 2007 at 05:25:26PM +0300, Miguel Mitrofanov wrote:
>>> That's not C.
>>> That's the C preprocessor, which is a textual substitution macro 
>>> language.
>> Well, the preprocessor is part of the language in a way. These two come
>> together.
> No. In fact, these are even two different programs, see man cpp.

No, in fact, preprocessing is an integral part of translating a C
program, see the standard.  The standard allows implementing the
translation phases 1-6 (the so-called preprocessing phases) as a
separate program, but there is no requirement to do that.

It is true, however, that preprocessing used to be (in pre-standard
days) separate from the language.  This has not been true for decades.

That said, this is all irrelevant to the question of whether C allows
first-class functions.  I'm sure we all are capable of writing Haskell
programs that do not have simple and readable translations to C :)

Antti-Juhani Kaijanaho, Jyväskylä, Finland

More information about the Haskell-Cafe mailing list